Skip to content

Commit 97373bf

Browse files
committed
Decorator: introduce SimpleEntityManagerDecorator
1 parent 677bd46 commit 97373bf

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/DI/OrmExtension.php

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use Doctrine\Common\Proxy\AbstractProxyFactory;
66
use Doctrine\DBAL\Connection;
77
use Doctrine\ORM\Configuration;
8-
use Doctrine\ORM\Decorator\EntityManagerDecorator;
98
use Doctrine\ORM\EntityManager as DoctrineEntityManager;
109
use Doctrine\ORM\Mapping\UnderscoreNamingStrategy;
1110
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
1211
use Nette\DI\Definitions\Statement;
1312
use Nette\DI\Helpers;
1413
use Nette\Schema\Expect;
1514
use Nette\Schema\Schema;
15+
use Nettrine\ORM\Decorator\SimpleEntityManagerDecorator;
1616
use Nettrine\ORM\DI\Definitions\SmartStatement;
1717
use Nettrine\ORM\Exception\Logical\InvalidArgumentException;
1818
use Nettrine\ORM\Exception\Logical\InvalidStateException;
@@ -35,7 +35,7 @@ public function getConfigSchema(): Schema
3535
$proxyDir = isset($parameters['tempDir']) ? $parameters['tempDir'] . '/proxies' : null;
3636

3737
return Expect::structure([
38-
'entityManagerDecoratorClass' => Expect::string(EntityManagerDecorator::class),
38+
'entityManagerDecoratorClass' => Expect::string(SimpleEntityManagerDecorator::class),
3939
'configurationClass' => Expect::string(Configuration::class),
4040
'configuration' => Expect::structure([
4141
'proxyDir' => Expect::string($proxyDir)->nullable(),
@@ -193,15 +193,16 @@ public function loadEntityManagerConfiguration(): void
193193

194194
// Manager Registry
195195
$builder->addDefinition($this->prefix('managerRegistry'))
196-
->setType(\Doctrine\Persistence\ManagerRegistry::class)
197196
->setFactory(ManagerRegistry::class, [
198-
$builder->getDefinitionByType(Connection::class),
197+
'@' . Connection::class,
199198
$this->prefix('@entityManagerDecorator'),
200199
]);
201200

202201
// Manager Provider
203202
$builder->addDefinition($this->prefix('managerProvider'))
204-
->setFactory(ManagerProvider::class, [$this->prefix('@managerRegistry')]);
203+
->setFactory(ManagerProvider::class, [
204+
$this->prefix('@managerRegistry'),
205+
]);
205206
}
206207

207208
public function loadMappingConfiguration(): void
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Nettrine\ORM\Decorator;
4+
5+
use Doctrine\ORM\Decorator\EntityManagerDecorator;
6+
7+
final class SimpleEntityManagerDecorator extends EntityManagerDecorator
8+
{
9+
10+
}

0 commit comments

Comments
 (0)