Skip to content

Commit 8232673

Browse files
Merge branch '4.3' into 4.4
* 4.3: Require doctrine/persistence ^1.3
2 parents 429d895 + 94125ba commit 8232673

33 files changed

+65
-132
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CHANGELOG
55
-----
66

77
* added `DoctrineClearEntityManagerWorkerSubscriber`
8-
* deprecated `RegistryInterface`, use `Doctrine\Common\Persistence\ManagerRegistry`
8+
* deprecated `RegistryInterface`, use `Doctrine\Persistence\ManagerRegistry`
99
* added support for invokable event listeners
1010
* added `getMetadataDriverClass` method to deprecate class parameters in service configuration files
1111

CacheWarmer/ProxyCacheWarmer.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\Doctrine\CacheWarmer;
1313

14-
use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
1514
use Doctrine\Persistence\ManagerRegistry;
1615
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
1716

@@ -27,10 +26,7 @@ class ProxyCacheWarmer implements CacheWarmerInterface
2726
{
2827
private $registry;
2928

30-
/**
31-
* @param ManagerRegistry|LegacyManagerRegistry $registry
32-
*/
33-
public function __construct($registry)
29+
public function __construct(ManagerRegistry $registry)
3430
{
3531
$this->registry = $registry;
3632
}

DataCollector/DoctrineDataCollector.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\Doctrine\DataCollector;
1313

14-
use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
1514
use Doctrine\DBAL\Logging\DebugStack;
1615
use Doctrine\DBAL\Types\ConversionException;
1716
use Doctrine\DBAL\Types\Type;
@@ -38,10 +37,7 @@ class DoctrineDataCollector extends DataCollector
3837
*/
3938
private $loggers = [];
4039

41-
/**
42-
* @param ManagerRegistry|LegacyManagerRegistry $registry
43-
*/
44-
public function __construct($registry)
40+
public function __construct(ManagerRegistry $registry)
4541
{
4642
$this->registry = $registry;
4743
$this->connections = $registry->getConnectionNames();

Form/ChoiceList/DoctrineChoiceLoader.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form\ChoiceList;
1313

14-
use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager;
1514
use Doctrine\Persistence\ObjectManager;
1615
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
1716
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
@@ -41,10 +40,9 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface
4140
* passed which optimizes the object loading for one of the Doctrine
4241
* mapper implementations.
4342
*
44-
* @param ObjectManager|LegacyObjectManager $manager The object manager
45-
* @param string $class The class name of the loaded objects
43+
* @param string $class The class name of the loaded objects
4644
*/
47-
public function __construct($manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
45+
public function __construct(ObjectManager $manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
4846
{
4947
$classMetadata = $manager->getClassMetadata($class);
5048

Form/ChoiceList/IdReader.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form\ChoiceList;
1313

14-
use Doctrine\Common\Persistence\Mapping\ClassMetadata as LegacyClassMetadata;
15-
use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager;
1614
use Doctrine\Persistence\Mapping\ClassMetadata;
1715
use Doctrine\Persistence\ObjectManager;
1816
use Symfony\Component\Form\Exception\RuntimeException;
@@ -37,11 +35,7 @@ class IdReader
3735
*/
3836
private $associationIdReader;
3937

40-
/**
41-
* @param ObjectManager|LegacyObjectManager $om
42-
* @param ClassMetadata|LegacyClassMetadata $classMetadata
43-
*/
44-
public function __construct($om, $classMetadata)
38+
public function __construct(ObjectManager $om, ClassMetadata $classMetadata)
4539
{
4640
$ids = $classMetadata->getIdentifierFieldNames();
4741
$idType = $classMetadata->getTypeOfField(current($ids));

Form/DoctrineOrmExtension.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form;
1313

14-
use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
1514
use Doctrine\Persistence\ManagerRegistry;
1615
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
1716
use Symfony\Component\Form\AbstractExtension;
@@ -20,10 +19,7 @@ class DoctrineOrmExtension extends AbstractExtension
2019
{
2120
protected $registry;
2221

23-
/**
24-
* @param ManagerRegistry|LegacyManagerRegistry $registry
25-
*/
26-
public function __construct($registry)
22+
public function __construct(ManagerRegistry $registry)
2723
{
2824
$this->registry = $registry;
2925
}

Form/DoctrineOrmTypeGuesser.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form;
1313

14-
use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
15-
use Doctrine\Common\Persistence\Mapping\MappingException as LegacyCommonMappingException;
16-
use Doctrine\Common\Persistence\Proxy;
1714
use Doctrine\DBAL\Types\Type;
1815
use Doctrine\ORM\Mapping\ClassMetadataInfo;
1916
use Doctrine\ORM\Mapping\MappingException as LegacyMappingException;
2017
use Doctrine\Persistence\ManagerRegistry;
2118
use Doctrine\Persistence\Mapping\MappingException;
19+
use Doctrine\Persistence\Proxy;
2220
use Symfony\Component\Form\FormTypeGuesserInterface;
2321
use Symfony\Component\Form\Guess\Guess;
2422
use Symfony\Component\Form\Guess\TypeGuess;
@@ -30,10 +28,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
3028

3129
private $cache = [];
3230

33-
/**
34-
* @param ManagerRegistry|LegacyManagerRegistry $registry
35-
*/
36-
public function __construct($registry)
31+
public function __construct(ManagerRegistry $registry)
3732
{
3833
$this->registry = $registry;
3934
}
@@ -187,8 +182,6 @@ protected function getMetadata($class)
187182
return $this->cache[$class] = [$em->getClassMetadata($class), $name];
188183
} catch (MappingException $e) {
189184
// not an entity or mapped super class
190-
} catch (LegacyCommonMappingException $e) {
191-
// not an entity or mapped super class
192185
} catch (LegacyMappingException $e) {
193186
// not an entity or mapped super class, using Doctrine ORM 2.2
194187
}
@@ -199,12 +192,10 @@ protected function getMetadata($class)
199192

200193
private static function getRealClass(string $class): string
201194
{
202-
$marker = interface_exists(Proxy::class) ? '\\'.Proxy::MARKER.'\\' : '\__CG__\\';
203-
204-
if (false === $pos = strrpos($class, $marker)) {
195+
if (false === $pos = strrpos($class, '\\'.Proxy::MARKER.'\\')) {
205196
return $class;
206197
}
207198

208-
return substr($class, $pos + \strlen($marker));
199+
return substr($class, $pos + Proxy::MARKER_LENGTH + 2);
209200
}
210201
}

Form/Type/DoctrineType.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
namespace Symfony\Bridge\Doctrine\Form\Type;
1313

1414
use Doctrine\Common\Collections\Collection;
15-
use Doctrine\Common\Persistence\ManagerRegistry as LegacyManagerRegistry;
16-
use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager;
1715
use Doctrine\Persistence\ManagerRegistry;
1816
use Doctrine\Persistence\ObjectManager;
1917
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
@@ -100,10 +98,7 @@ public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
10098
return null;
10199
}
102100

103-
/**
104-
* @param ManagerRegistry|LegacyManagerRegistry $registry
105-
*/
106-
public function __construct($registry)
101+
public function __construct(ManagerRegistry $registry)
107102
{
108103
$this->registry = $registry;
109104
}
@@ -194,7 +189,7 @@ public function configureOptions(OptionsResolver $resolver)
194189

195190
$emNormalizer = function (Options $options, $em) {
196191
if (null !== $em) {
197-
if ($em instanceof ObjectManager || $em instanceof LegacyObjectManager) {
192+
if ($em instanceof ObjectManager) {
198193
return $em;
199194
}
200195

@@ -264,7 +259,7 @@ public function configureOptions(OptionsResolver $resolver)
264259
$resolver->setNormalizer('query_builder', $queryBuilderNormalizer);
265260
$resolver->setNormalizer('id_reader', $idReaderNormalizer);
266261

267-
$resolver->setAllowedTypes('em', ['null', 'string', ObjectManager::class, LegacyObjectManager::class]);
262+
$resolver->setAllowedTypes('em', ['null', 'string', ObjectManager::class]);
268263
}
269264

270265
/**
@@ -275,7 +270,7 @@ public function configureOptions(OptionsResolver $resolver)
275270
*
276271
* @return EntityLoaderInterface
277272
*/
278-
abstract public function getLoader(LegacyObjectManager $manager, $queryBuilder, $class);
273+
abstract public function getLoader(ObjectManager $manager, $queryBuilder, $class);
279274

280275
public function getParent()
281276
{

Form/Type/EntityType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form\Type;
1313

14-
use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager;
1514
use Doctrine\ORM\Query\Parameter;
1615
use Doctrine\ORM\QueryBuilder;
16+
use Doctrine\Persistence\ObjectManager;
1717
use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
1818
use Symfony\Component\Form\Exception\UnexpectedTypeException;
1919
use Symfony\Component\OptionsResolver\Options;
@@ -51,7 +51,7 @@ public function configureOptions(OptionsResolver $resolver)
5151
*
5252
* @return ORMQueryBuilderLoader
5353
*/
54-
public function getLoader(LegacyObjectManager $manager, $queryBuilder, $class)
54+
public function getLoader(ObjectManager $manager, $queryBuilder, $class)
5555
{
5656
if (!$queryBuilder instanceof QueryBuilder) {
5757
throw new \TypeError(sprintf('Expected an instance of %s, but got %s.', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));

ManagerRegistry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine;
1313

14-
use Doctrine\Common\Persistence\AbstractManagerRegistry as LegacyAbstractManagerRegistry;
14+
use Doctrine\Persistence\AbstractManagerRegistry;
1515
use ProxyManager\Proxy\LazyLoadingInterface;
1616
use Symfony\Component\DependencyInjection\Container;
1717

@@ -20,7 +20,7 @@
2020
*
2121
* @author Lukas Kahwe Smith <[email protected]>
2222
*/
23-
abstract class ManagerRegistry extends LegacyAbstractManagerRegistry
23+
abstract class ManagerRegistry extends AbstractManagerRegistry
2424
{
2525
/**
2626
* @var Container

0 commit comments

Comments
 (0)