|
32 | 32 | use Doctrine\ORM\Mapping\Driver\AttributeDriver;
|
33 | 33 | use Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver;
|
34 | 34 | use Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver;
|
| 35 | +use Doctrine\ORM\Mapping\Entity; |
35 | 36 | use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
|
36 | 37 | use InvalidArgumentException;
|
37 | 38 | use LogicException;
|
@@ -1165,6 +1166,32 @@ public static function cacheConfigurationProvider(): array
|
1165 | 1166 | ];
|
1166 | 1167 | }
|
1167 | 1168 |
|
| 1169 | + public function testEntityAttributeExcludesFromContainer() |
| 1170 | + { |
| 1171 | + if (! interface_exists(EntityManagerInterface::class)) { |
| 1172 | + self::markTestSkipped('This test requires ORM'); |
| 1173 | + } |
| 1174 | + |
| 1175 | + $container = $this->getContainer(); |
| 1176 | + $extension = new DoctrineExtension(); |
| 1177 | + |
| 1178 | + $config = BundleConfigurationBuilder::createBuilder() |
| 1179 | + ->addBaseConnection() |
| 1180 | + ->addBaseEntityManager() |
| 1181 | + ->build(); |
| 1182 | + |
| 1183 | + $extension->load([$config], $container); |
| 1184 | + |
| 1185 | + $attributes = $container->getAutoconfiguredAttributes(); |
| 1186 | + $this->assertInstanceOf(Closure::class, $attributes[Entity::class]); |
| 1187 | + |
| 1188 | + $definition = new ChildDefinition(''); |
| 1189 | + $attributes[Entity::class]($definition); |
| 1190 | + |
| 1191 | + $this->assertSame([['source' => 'with #[Doctrine\ORM\Mapping\Entity] attribute']], $definition->getTag('container.excluded')); |
| 1192 | + $this->assertTrue($definition->isAbstract()); |
| 1193 | + } |
| 1194 | + |
1168 | 1195 | public function testAsEntityListenerAttribute()
|
1169 | 1196 | {
|
1170 | 1197 | if (! interface_exists(EntityManagerInterface::class)) {
|
|
0 commit comments