Conditions | 4 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 7.1753 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | 1 | public function boot() |
|
21 | { |
||
22 | // Register an autoloader for proxies to avoid issues when unserializing them when the OGM is used. |
||
23 | 1 | if ($this->container->has('neo4j.entity_manager')) { |
|
24 | // See https://github.com/symfony/symfony/pull/3419 for usage of references |
||
25 | 1 | $container = &$this->container; |
|
26 | $this->autoloader = function ($class) use (&$container) { |
||
27 | if (0 === strpos($class, 'neo4j_ogm_proxy')) { |
||
28 | $cacheDir = $container->getParameter('kernel.cache_dir').DIRECTORY_SEPARATOR.'neo4j'; |
||
29 | $file = $cacheDir.DIRECTORY_SEPARATOR.$class.'.php'; |
||
30 | if (file_exists($file)) { |
||
31 | require_once $file; |
||
32 | } |
||
33 | } |
||
34 | }; |
||
35 | 1 | spl_autoload_register($this->autoloader); |
|
36 | } |
||
37 | 1 | } |
|
38 | |||
47 |