8000 Address deprecations from persistence library · greg0ire/DoctrineMongoDBBundle@7983394 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7983394

Browse files
committed
Address deprecations from persistence library
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 methods signatures for which compatibility checks may happen, so that signature compatibility is recognized by old versions of php. More details on this at https://dev.to/greg0ire/how-to-deprecate-a-type-in-php-48cf Fixes doctrine#616 as a side effect, but the real fix is at symfony/symfony#35728
1 parent e105f23 commit 7983394

22 files changed

+28
-24
lines changed

CacheWarmer/HydratorCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Doctrine\Bundle\MongoDBBundle\CacheWarmer;
66

7-
use Doctrine\Common\Persistence\ManagerRegistry;
87
use Doctrine\ODM\MongoDB\Configuration;
98
use Doctrine\ODM\MongoDB\DocumentManager;
9+
use Doctrine\Persistence\ManagerRegistry;
1010
use RuntimeException;
1111
use Symfony\Component\DependencyInjection\ContainerInterface;
1212
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;

CacheWarmer/PersistentCollectionCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Doctrine\Bundle\MongoDBBundle\CacheWarmer;
66

7-
use Doctrine\Common\Persistence\ManagerRegistry;
87
use Doctrine\ODM\MongoDB\Configuration;
98
use Doctrine\ODM\MongoDB\DocumentManager;
9+
use Doctrine\Persistence\ManagerRegistry;
1010
use RuntimeException;
1111
use Symfony\Component\DependencyInjection\ContainerInterface;
1212
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;

CacheWarmer/ProxyCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Doctrine\Bundle\MongoDBBundle\CacheWarmer;
66

7-
use Doctrine\Common\Persistence\ManagerRegistry;
87
use Doctrine\ODM\MongoDB\Configuration;
98
use Doctrine\ODM\MongoDB\DocumentManager;
109
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
10+
use Doctrine\Persistence\ManagerRegistry;
1111
use RuntimeException;
1212
use Symfony\Component\DependencyInjection\ContainerInterface;
1313
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;

DependencyInjection/Compiler/DoctrineMongoDBMappingsPass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler;
66

7-
use Doctrine\Common\Persistence\Mapping\Driver\PHPDriver;
8-
use Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver;
9-
use Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator;
107
use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;
118
use Doctrine\ODM\MongoDB\Mapping\Driver\XmlDriver;
9+
use Doctrine\Persistence\Mapping\Driver\PHPDriver;
10+
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
11+
use Doctrine\Persistence\Mapping\Driver\SymfonyFileLocator;
1212
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterMappingsPass;
1313
use Symfony\Component\DependencyInjection\Definition;
1414
use Symfony\Component\DependencyInjection\Reference;

Form/ChoiceList/MongoDBQueryBuilderLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace Doctrine\Bundle\MongoDBBundle\Form\ChoiceList;
66

77
use Closure;
8-
use Doctrine\Common\Persistence\ObjectManager;
98
use Doctrine\ODM\MongoDB\Query\Builder;
9+
use Doctrine\Persistence\ObjectManager;
1010
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
1111
use Symfony\Component\Form\Exception\UnexpectedTypeException;
1212
use function array_values;

Form/DoctrineMongoDBExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Doctrine\Bundle\MongoDBBundle\Form;
66

7-
use Doctrine\Common\Persistence\ManagerRegistry;
87
use Symfony\Component\Form\AbstractExtension;
8+
use Doctrine\Persistence\ManagerRegistry;
99

1010
/**
1111
* Form extension.

Form/DoctrineMongoDBTypeGuesser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace Doctrine\Bundle\MongoDBBundle\Form;
66

77
use Doctrine\Bundle\MongoDBBundle\Form\Type\DocumentType;
8-
use Doctrine\Common\Persistence\ManagerRegistry;
9-
use Doctrine\Common\Persistence\Mapping\MappingException;
8+
use Doctrine\Persistence\ManagerRegistry;
9+
use Doctrine\Persistence\Mapping\MappingException;
1010
use Symfony\Component\Form\AbstractType;
1111
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
1212
use Symfony\Component\Form\Extension\Core\Type\CollectionType;

Form/Type/DocumentType.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
namespace Doctrine\Bundle\MongoDBBundle\Form\Type;
66

77
use Doctrine\Bundle\MongoDBBundle\Form\ChoiceList\MongoDBQueryBuilderLoader;
8-
use Doctrine\Common\Persistence\ObjectManager;
98
use Doctrine\ODM\MongoDB\DocumentManager;
9+
use Doctrine\Persistence\ObjectManager;
1010
use InvalidArgumentException;
1111
use Symfony\Bridge\Doctrine\Form\Type\DoctrineType;
1212
use Symfony\Component\OptionsResolver\Options;
1313
use Symfony\Component\OptionsResolver\OptionsResolver;
14+
use function interface_exists;
1415

1516
/**
1617
* Form type for a MongoDB document
@@ -83,3 +84,5 @@ public function getName()
8384
return $this->getBlockPrefix();
8485
}
8586
}
87+
88+
interface_exists(ObjectManager::class);

Repository/ContainerRepositoryFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace Doctrine\Bundle\MongoDBBundle\Repository;
66

77
use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass;
8-
use Doctrine\Common\Persistence\ObjectRepository;
98
use Doctrine\ODM\MongoDB\DocumentManager;
109
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
1110
use Doctrine\ODM\MongoDB\Repository\DocumentRepository;
1211
use Doctrine\ODM\MongoDB\Repository\RepositoryFactory;
12+
use Doctrine\Persistence\ObjectRepository;
1313
use Psr\Container\ContainerInterface;
1414
use RuntimeException;
1515
use function class_exists;

Repository/ServiceRepositoryTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace Doctrine\Bundle\MongoDBBundle\Repository;
66

7-
use Doctrine\Common\Persistence\ManagerRegistry;
87
use Doctrine\ODM\MongoDB\DocumentManager;
8+
use Doctrine\Persistence\ManagerRegistry;
99
use LogicException;
1010
use function sprintf;
1111

0 commit comments

Comments
 (0)
0