From 497de83d2957029cd3e9a92142e6e58f06f6c702 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Sat, 17 Aug 2024 18:30:40 -0300 Subject: [PATCH] Fix entity manager acquisition in the example app --- example/bin/console | 3 ++- example/bin/console.php | 6 ------ example/em.php | 13 ++++--------- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/example/bin/console b/example/bin/console index 324f1632f2..6073cf9307 100755 --- a/example/bin/console +++ b/example/bin/console @@ -1,6 +1,7 @@ #!/usr/bin/env php run(); - diff --git a/example/bin/console.php b/example/bin/console.php index 42ab6f16aa..824d8c07d6 100644 --- a/example/bin/console.php +++ b/example/bin/console.php @@ -16,12 +16,6 @@ use Gedmo\DoctrineExtensions; use Symfony\Component\Console\Application; -/* - * This file is part of the Doctrine Behavioral Extensions package. - * (c) Gediminas Morkevicius http://www.gediminasm.org - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ /** @var EntityManager $em */ $em = include __DIR__.'/../em.php'; diff --git a/example/em.php b/example/em.php index 1ba7b8af55..8f9ea8d484 100644 --- a/example/em.php +++ b/example/em.php @@ -28,13 +28,6 @@ use Gedmo\Tree\TreeListener; use Symfony\Component\Cache\Adapter\ArrayAdapter; -/* - * This file is part of the Doctrine Behavioral Extensions package. - * (c) Gediminas Morkevicius http://www.gediminasm.org - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - // this entity manager configuration works with the Doctrine DBAL and ORM. // Regarding the AnnotationDriver setup, it most probably will be changed into // XML because the annotation driver fails to read other classes in same namespace. @@ -176,6 +169,8 @@ $config->setQueryCache($cache); $config->setResultCache($cache); -// Finally, we create the entity manager $connection = DriverManager::getConnection($connection, $config); -$em = new EntityManager($connection, $config, $eventManager); + +// Finally, we create and return the entity manager + +return new EntityManager($connection, $config, $eventManager);