Skip to content

Commit

Permalink
Merge branch 'fix/#6626-skip-proxy-generation-for-embeddable-classes'
Browse files Browse the repository at this point in the history
Close #6626
Close #6625
  • Loading branch information
Ocramius committed Aug 16, 2017
2 parents 57a9509 + 71218b6 commit 9005c5a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Doctrine/ORM/Proxy/ProxyFactory.php
Expand Up @@ -91,7 +91,9 @@ public function __construct(EntityManagerInterface $em, $proxyDir, $proxyNs, $au
protected function skipClass(ClassMetadata $metadata)
{
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadataInfo */
return $metadata->isMappedSuperclass || $metadata->getReflectionClass()->isAbstract();
return $metadata->isMappedSuperclass
|| $metadata->isEmbeddedClass
|| $metadata->getReflectionClass()->isAbstract();
}

/**
Expand Down
27 changes: 27 additions & 0 deletions tests/Doctrine/Tests/ORM/Proxy/ProxyFactoryTest.php
Expand Up @@ -75,6 +75,33 @@ public function testReferenceProxyDelegatesLoadingToThePersister()
$proxy->getDescription();
}

public function testSkipMappedSuperClassesOnGeneration(): void
{
$cm = new ClassMetadata(\stdClass::class);
$cm->isMappedSuperclass = true;

self::assertSame(
0,
$this->proxyFactory->generateProxyClasses([$cm]),
'No proxies generated.'
);
}

/**
* @group 6625
*/
public function testSkipEmbeddableClassesOnGeneration(): void
{
$cm = new ClassMetadata(\stdClass::class);
$cm->isEmbeddedClass = true;

self::assertSame(
0,
$this->proxyFactory->generateProxyClasses([$cm]),
'No proxies generated.'
);
}

/**
* @group DDC-1771
*/
Expand Down

0 comments on commit 9005c5a

Please sign in to comment.