1
0
mirror of synced 2025-01-23 16:51:41 +03:00

lifts an unnecessary restriction on ResultSetMappingBuilder

This commit is contained in:
Johannes M. Schmitt 2013-11-23 19:44:33 +01:00
parent 75d7ac2783
commit 8ae48ad9db

View File

@ -142,8 +142,8 @@ class ResultSetMappingBuilder extends ResultSetMapping
$classMetadata = $this->em->getClassMetadata($class);
$platform = $this->em->getConnection()->getDatabasePlatform();
if ($classMetadata->isInheritanceTypeSingleTable() || $classMetadata->isInheritanceTypeJoined()) {
throw new \InvalidArgumentException('ResultSetMapping builder does not currently support inheritance.');
if ( ! $this->isInheritanceSupported($classMetadata)) {
throw new \InvalidArgumentException('ResultSetMapping builder does not currently support your inheritance scheme.');
}
@ -179,6 +179,16 @@ class ResultSetMappingBuilder extends ResultSetMapping
}
}
private function isInheritanceSupported(ClassMetadataInfo $classMetadata)
{
if ($classMetadata->isInheritanceTypeSingleTable()
&& in_array($classMetadata->name, $classMetadata->discriminatorMap, true)) {
return true;
}
return ! ($classMetadata->isInheritanceTypeSingleTable() || $classMetadata->isInheritanceTypeJoined());
}
/**
* Gets column alias for a given column.
*