From 395a530f270a97b33c3ee49ccb6f88f98b74e147 Mon Sep 17 00:00:00 2001 From: bakyt Date: Tue, 21 Nov 2023 09:26:55 +0500 Subject: [PATCH] Updated documentation for config-cli.php file according to v3.7.x --- docs/en/reference/configuration.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/en/reference/configuration.rst b/docs/en/reference/configuration.rst index d451c1ac3..7b92c7520 100644 --- a/docs/en/reference/configuration.rst +++ b/docs/en/reference/configuration.rst @@ -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));