Skip to content

Commit 497de83

Browse files
committed
Fix entity manager acquisition in the example app
1 parent 93d8133 commit 497de83

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

example/bin/console

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env php
22
<?php
33

4+
declare(strict_types=1);
5+
46
$cli = include __DIR__.'/console.php';
57
$cli->run();
6-

example/bin/console.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
use Gedmo\DoctrineExtensions;
1717
use Symfony\Component\Console\Application;
1818

19-
/*
20-
* This file is part of the Doctrine Behavioral Extensions package.
21-
* (c) Gediminas Morkevicius <[email protected]> http://www.gediminasm.org
22-
* For the full copyright and license information, please view the LICENSE
23-
* file that was distributed with this source code.
24-
*/
2519
/** @var EntityManager $em */
2620
$em = include __DIR__.'/../em.php';
2721

example/em.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@
2828
use Gedmo\Tree\TreeListener;
2929
use Symfony\Component\Cache\Adapter\ArrayAdapter;
3030

31-
/*
32-
* This file is part of the Doctrine Behavioral Extensions package.
33-
* (c) Gediminas Morkevicius <[email protected]> http://www.gediminasm.org
34-
* For the full copyright and license information, please view the LICENSE
35-
* file that was distributed with this source code.
36-
*/
37-
3831
// this entity manager configuration works with the Doctrine DBAL and ORM.
3932
// Regarding the AnnotationDriver setup, it most probably will be changed into
4033
// XML because the annotation driver fails to read other classes in same namespace.
@@ -176,6 +169,8 @@
176169
$config->setQueryCache($cache);
177170
$config->setResultCache($cache);
178171

179-
// Finally, we create the entity manager
180172
$connection = DriverManager::getConnection($connection, $config);
181-
$em = new EntityManager($connection, $config, $eventManager);
173+
174+
// Finally, we create and return the entity manager
175+
176+
return new EntityManager($connection, $config, $eventManager);

0 commit comments

Comments
 (0)