本文整理汇总了PHP中Doctrine\ORM\Mapping\MappingException::invalidOverrideFieldName方法的典型用法代码示例。如果您正苦于以下问题:PHP MappingException::invalidOverrideFieldName方法的具体用法?PHP MappingException::invalidOverrideFieldName怎么用?PHP MappingException::invalidOverrideFieldName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\MappingException
的用法示例。
在下文中一共展示了MappingException::invalidOverrideFieldName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAttributeOverride
/**
* Sets the override for a mapped field.
*
* @param string $fieldName
* @param array $overrideMapping
* @throws MappingException
* @param array $overrideMapping
* @return void
*/
public function setAttributeOverride($fieldName, array $overrideMapping)
{
if (!isset($this->fieldMappings[$fieldName])) {
throw MappingException::invalidOverrideFieldName($this->name, $fieldName);
}
$mapping = $this->fieldMappings[$fieldName];
if (isset($mapping['id'])) {
$overrideMapping['id'] = $mapping['id'];
}
if (!isset($overrideMapping['type']) || $overrideMapping['type'] === null) {
$overrideMapping['type'] = $mapping['type'];
}
if (!isset($overrideMapping['fieldName']) || $overrideMapping['fieldName'] === null) {
$overrideMapping['fieldName'] = $mapping['fieldName'];
}
if ($overrideMapping['type'] !== $mapping['type']) {
throw MappingException::invalidOverrideFieldType($this->name, $fieldName);
}
unset($this->fieldMappings[$fieldName]);
unset($this->fieldNames[$mapping['columnName']]);
unset($this->columnNames[$mapping['fieldName']]);
$this->_validateAndCompleteFieldMapping($overrideMapping);
$this->fieldMappings[$fieldName] = $overrideMapping;
}