Skip to content

Commit

Permalink
Merge pull request #30 from MarioDevment/chore/update-namespace-doctrine
Browse files Browse the repository at this point in the history
Fix namespace in doctrine persistence
  • Loading branch information
klaussilveira authored Jan 21, 2021
2 parents 9080e2f + f392197 commit ca40127
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
13 changes: 5 additions & 8 deletions src/Provider/OrmServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
use Doctrine\Common\Cache\FilesystemCache;
use Doctrine\Common\Cache\MemcachedCache;
use Doctrine\Common\Cache\RedisCache;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\Common\Persistence\Mapping\Driver\StaticPHPDriver;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Cache\DefaultCacheFactory;
use Doctrine\ORM\Cache\Region\DefaultRegion;
Expand All @@ -27,6 +24,9 @@
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\ORM\Mapping\Driver\YamlDriver;
use Doctrine\ORM\Repository\DefaultRepositoryFactory;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
use Pimple\Container;
use Pimple\ServiceProviderInterface;

Expand Down Expand Up @@ -143,9 +143,7 @@ public function register(Container $container): void

foreach ((array) $options['mappings'] as $entity) {
if (!is_array($entity)) {
throw new \InvalidArgumentException(
"The 'orm.em.options' option 'mappings' should be an array of arrays."
);
throw new \InvalidArgumentException("The 'orm.em.options' option 'mappings' should be an array of arrays.");
}

if (isset($entity['alias'])) {
Expand Down Expand Up @@ -335,7 +333,7 @@ public function register(Container $container): void
return $container[$cacheInstanceKey] = $container['orm.mapping_driver_chain.factory']($name);
});

$container['orm.mapping_driver_chain.factory'] = $container->protect(function ($name) use ($container) {
$container['orm.mapping_driver_chain.factory'] = $container->protect(function ($name) {
return new MappingDriverChain();
});

Expand Down Expand Up @@ -383,7 +381,6 @@ public function register(Container $container): void
/**
* Get default ORM configuration settings.
*
*
* @return array
*/
protected function getOrmDefaults()
Expand Down
16 changes: 8 additions & 8 deletions tests/Provider/OrmServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testRegisterDefaultImplementations(): void
$this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container['orm.em.config']->getResultCacheImpl());
$this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container['orm.em.config']->getMetadataCacheImpl());
$this->assertInstanceOf('Doctrine\Common\Cache\ArrayCache', $container['orm.em.config']->getHydrationCacheImpl());
$this->assertInstanceOf('Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain', $container['orm.em.config']->getMetadataDriverImpl());
$this->assertInstanceOf('Doctrine\Persistence\Mapping\Driver\MappingDriverChain', $container['orm.em.config']->getMetadataDriverImpl());
}

/**
Expand All @@ -73,7 +73,7 @@ public function testRegisterDefinedImplementations(): void
$resultCache = $this->getMock('Doctrine\Common\Cache\ArrayCache');
$metadataCache = $this->getMock('Doctrine\Common\Cache\ArrayCache');

$mappingDriverChain = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain');
$mappingDriverChain = $this->getMock('Doctrine\Persistence\Mapping\Driver\MappingDriverChain');

$container['orm.cache.instances.default.query'] = $queryCache;
$container['orm.cache.instances.default.result'] = $resultCache;
Expand Down Expand Up @@ -113,8 +113,8 @@ public function testProxyConfigurationDefined(): void

$container->register(new OrmServiceProvider());

$entityRepositoryClassName = get_class($this->getMock('Doctrine\Common\Persistence\ObjectRepository'));
$metadataFactoryName = get_class($this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadataFactory'));
$entityRepositoryClassName = get_class($this->getMock('Doctrine\Persistence\ObjectRepository'));
$metadataFactoryName = get_class($this->getMock('Doctrine\Persistence\Mapping\ClassMetadataFactory'));

$entityListenerResolver = $this->getMock('Doctrine\ORM\Mapping\EntityListenerResolver');
$repositoryFactory = $this->getMock('Doctrine\ORM\Repository\RepositoryFactory');
Expand Down Expand Up @@ -159,9 +159,9 @@ public function testAddMappingDriverDefault(): void
{
$container = $this->createMockDefaultApp();

$mappingDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver');
$mappingDriver = $this->getMock('Doctrine\Persistence\Mapping\Driver\MappingDriver');

$mappingDriverChain = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain');
$mappingDriverChain = $this->getMock('Doctrine\Persistence\Mapping\Driver\MappingDriverChain');
$mappingDriverChain
->expects($this->once())
->method('addDriver')
Expand All @@ -181,9 +181,9 @@ public function testAddMappingDriverNamedEntityManager(): void
{
$container = $this->createMockDefaultApp();

$mappingDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver');
$mappingDriver = $this->getMock('Doctrine\Persistence\Mapping\Driver\MappingDriver');

$mappingDriverChain = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain');
$mappingDriverChain = $this->getMock('Doctrine\Persistence\Mapping\Driver\MappingDriverChain');
$mappingDriverChain
->expects($this->once())
->method('addDriver')
Expand Down

0 comments on commit ca40127

Please sign in to comment.