Skip to content

Commit

Permalink
Fix entity manager acquisition in the example app
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Aug 17, 2024
1 parent 93d8133 commit 497de83
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
3 changes: 2 additions & 1 deletion example/bin/console
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

$cli = include __DIR__.'/console.php';
$cli->run();

6 changes: 0 additions & 6 deletions example/bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]> 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';

Expand Down
13 changes: 4 additions & 9 deletions example/em.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]> 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.
Expand Down Expand Up @@ -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);

0 comments on commit 497de83

Please sign in to comment.