Skip to content

Commit d080761

Browse files
authored
Add alias for the interface (#52)
* Add alias for the interface * Make sure we are more resitant for errors * Adding more aliases * cs
1 parent 47841ac commit d080761

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Collector/QueryLogger.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,18 @@ public function record(StatementInterface $statement)
4747
$idx = $this->nbQueries++;
4848
$this->statements[$idx] = [
4949
'start_time' => microtime(true) * 1000,
50-
'end_time' => microtime(true) * 1000, // same
51-
'nb_results' => 0,
5250
'query' => $statementText,
5351
'parameters' => $statementParams,
5452
'tag' => $statement->getTag(),
53+
54+
// Add dummy data in case we never run logException or finish
55+
'end_time' => microtime(true) * 1000, // same
56+
'nb_results' => 0,
5557
'statistics' => [],
58+
'scheme' => '',
59+
'success' => false,
60+
'exceptionCode' => 0,
61+
'exceptionMessage' => '',
5662
];
5763
$this->statementsHash[$statementText][$statementParams][$tag] = $idx;
5864
}

DependencyInjection/Neo4jExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
namespace Neo4j\Neo4jBundle\DependencyInjection;
66

77
use GraphAware\Bolt\Driver as BoltDriver;
8+
use GraphAware\Neo4j\Client\ClientInterface;
89
use GraphAware\Neo4j\Client\Connection\Connection;
910
use GraphAware\Neo4j\OGM\EntityManager;
1011
use GraphAware\Neo4j\Client\HttpDriver\Driver as HttpDriver;
12+
use GraphAware\Neo4j\OGM\EntityManagerInterface;
1113
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1214
use Symfony\Component\Config\FileLocator;
1315
use Symfony\Component\DependencyInjection\ChildDefinition;
@@ -41,11 +43,14 @@ public function load(array $configs, ContainerBuilder $container)
4143
$loader->load('entity_manager.xml');
4244
$this->handleEntityManagers($config, $container, $clientServiceIds);
4345
$container->setAlias('neo4j.entity_manager', 'neo4j.entity_manager.default');
46+
$container->setAlias(EntityManagerInterface::class, 'neo4j.entity_manager.default');
4447
}
4548

4649
// add aliases for the default services
4750
$container->setAlias('neo4j.connection', 'neo4j.connection.default');
51+
$container->setAlias(Connection::class, 'neo4j.connection.default');
4852
$container->setAlias('neo4j.client', 'neo4j.client.default');
53+
$container->setAlias(ClientInterface::class, 'neo4j.client.default');
4954

5055
// Configure toolbar
5156
if ($this->isConfigEnabled($container, $config['profiling'])) {

Resources/config/services.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
<service id="neo4j.client.abstract" class="GraphAware\Neo4j\Client\Client" abstract="true">
1515
<factory service="neo4j.factory.client" method="create" />
16-
1716
</service>
1817
</services>
1918
</container>

0 commit comments

Comments
 (0)