Skip to content

Commit

Permalink
Merge pull request #1378 from baktify/3.7.x-actualized-config-cli
Browse files Browse the repository at this point in the history
Updated documentation for config-cli.php file according to v3.7.x
  • Loading branch information
greg0ire committed Nov 21, 2023
2 parents e4e0855 + 395a530 commit 78484f9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/en/reference/configuration.rst
Expand Up @@ -348,17 +348,21 @@ Now update your ``cli-config.php`` in the root of your project to look like the
require 'vendor/autoload.php';
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\ORMSetup;
use Doctrine\Migrations\Configuration\EntityManager\ExistingEntityManager;
use Doctrine\Migrations\DependencyFactory;
use Doctrine\Migrations\Configuration\Migration\PhpFile;
use Doctrine\DBAL\DriverManager;
$config = new PhpFile('migrations.php'); // Or use one of the Doctrine\Migrations\Configuration\Configuration\* loaders
$paths = [__DIR__.'/lib/MyProject/Entities'];
$isDevMode = true;
$ORMconfig = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create(['driver' => 'pdo_sqlite', 'memory' => true], $ORMconfig);
$ORMConfig = ORMSetup::createAttributeMetadataConfiguration($paths, $isDevMode);
$connection = DriverManager::getConnection(['driver' => 'pdo_sqlite', 'memory' => true]);
$entityManager = new EntityManager($connection, $ORMConfig);
return DependencyFactory::fromEntityManager($config, new ExistingEntityManager($entityManager));
Expand Down

0 comments on commit 78484f9

Please sign in to comment.