lifts an unnecessary restriction on ResultSetMappingBuilder
This commit is contained in:
parent
75d7ac2783
commit
8ae48ad9db
@ -142,8 +142,8 @@ class ResultSetMappingBuilder extends ResultSetMapping
|
|||||||
$classMetadata = $this->em->getClassMetadata($class);
|
$classMetadata = $this->em->getClassMetadata($class);
|
||||||
$platform = $this->em->getConnection()->getDatabasePlatform();
|
$platform = $this->em->getConnection()->getDatabasePlatform();
|
||||||
|
|
||||||
if ($classMetadata->isInheritanceTypeSingleTable() || $classMetadata->isInheritanceTypeJoined()) {
|
if ( ! $this->isInheritanceSupported($classMetadata)) {
|
||||||
throw new \InvalidArgumentException('ResultSetMapping builder does not currently support inheritance.');
|
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.
|
* Gets column alias for a given column.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user