本文整理汇总了PHP中Doctrine\ORM\Mapping\MappingException::illegalToManyAssocationOnMappedSuperclass方法的典型用法代码示例。如果您正苦于以下问题:PHP MappingException::illegalToManyAssocationOnMappedSuperclass方法的具体用法?PHP MappingException::illegalToManyAssocationOnMappedSuperclass怎么用?PHP MappingException::illegalToManyAssocationOnMappedSuperclass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\MappingException
的用法示例。
在下文中一共展示了MappingException::illegalToManyAssocationOnMappedSuperclass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addInheritedRelations
/**
* Adds inherited association mappings to the subclass mapping.
*
* @param \Doctrine\ORM\Mapping\ClassMetadata $subClass
* @param \Doctrine\ORM\Mapping\ClassMetadata $parentClass
*
* @return void
*
* @throws MappingException
*/
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
{
foreach ($parentClass->associationMappings as $field => $mapping) {
if ($parentClass->isMappedSuperclass) {
if ($mapping['type'] & ClassMetadata::TO_MANY && !$mapping['isOwningSide']) {
throw MappingException::illegalToManyAssocationOnMappedSuperclass($parentClass->name, $field);
}
$mapping['sourceEntity'] = $subClass->name;
}
//$subclassMapping = $mapping;
if (!isset($mapping['inherited']) && !$parentClass->isMappedSuperclass) {
$mapping['inherited'] = $parentClass->name;
}
if (!isset($mapping['declared'])) {
$mapping['declared'] = $parentClass->name;
}
$subClass->addInheritedAssociationMapping($mapping);
}
}