From ca13b36033d66ef57d4780af9e96ef971fec239e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 10 Jan 2020 22:25:49 +0100 Subject: [PATCH] Address deprecations from doctrine/persistence A backwards-compatibility layer has been added to persistence to help consumers move to the new namespacing. It is based on class aliases, which means the type declaration changes should not be a BC-break: types are the same. See doctrine/persistence#71 This means: - using the new namespaces - adding autoload calls for new types to types that may be extended and use persistence types in type declarations of non-constructor methods, so that signature compatibility is recognized by old versions of php. Luckily, there were none of these in this package. More details on this at https://dev.to/greg0ire/how-to-deprecate-a-type-in-php-48cf --- composer.json | 1 + src/Model/ModelManager.php | 2 +- tests/Model/ModelManagerTest.php | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 06c587bcd..80930aff0 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,7 @@ "php": "^7.1", "doctrine/doctrine-bundle": "^1.8 || ^2.0", "doctrine/orm": "^2.5", + "doctrine/persistence": "^1.3.4", "sonata-project/admin-bundle": "^3.29", "sonata-project/core-bundle": "^3.14", "sonata-project/exporter": "^1.11.0 || ^2.0", diff --git a/src/Model/ModelManager.php b/src/Model/ModelManager.php index fda9da020..885676e05 100644 --- a/src/Model/ModelManager.php +++ b/src/Model/ModelManager.php @@ -13,7 +13,6 @@ namespace Sonata\DoctrineORMAdminBundle\Model; -use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\Common\Util\ClassUtils; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\LockMode; @@ -25,6 +24,7 @@ use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\UnitOfWork; +use Doctrine\Persistence\ManagerRegistry; use Sonata\AdminBundle\Admin\FieldDescriptionInterface; use Sonata\AdminBundle\Datagrid\DatagridInterface; use Sonata\AdminBundle\Datagrid\ProxyQueryInterface; diff --git a/tests/Model/ModelManagerTest.php b/tests/Model/ModelManagerTest.php index 497c340ba..f896815ca 100644 --- a/tests/Model/ModelManagerTest.php +++ b/tests/Model/ModelManagerTest.php @@ -14,8 +14,6 @@ namespace Sonata\DoctrineORMAdminBundle\Tests\Model; use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Persistence\ManagerRegistry; -use Doctrine\Common\Persistence\ObjectManager; use Doctrine\DBAL\Connection; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Platforms\MySqlPlatform; @@ -30,6 +28,8 @@ use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; +use Doctrine\Persistence\ManagerRegistry; +use Doctrine\Persistence\ObjectManager; use PHPUnit\Framework\TestCase; use Sonata\AdminBundle\Datagrid\Datagrid; use Sonata\AdminBundle\Datagrid\DatagridInterface;