本文整理汇总了PHP中Doctrine\ORM\Mapping\MappingException::duplicateColumnName方法的典型用法代码示例。如果您正苦于以下问题:PHP MappingException::duplicateColumnName方法的具体用法?PHP MappingException::duplicateColumnName怎么用?PHP MappingException::duplicateColumnName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Mapping\MappingException
的用法示例。
在下文中一共展示了MappingException::duplicateColumnName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDiscriminatorColumn
/**
* Sets the discriminator column definition.
*
* @param array $columnDef
*
* @param $columnDef
* @throws MappingException
* @return void
* @see getDiscriminatorColumn()
*/
public function setDiscriminatorColumn($columnDef)
{
if ($columnDef !== null) {
if (!isset($columnDef['name'])) {
throw MappingException::nameIsMandatoryForDiscriminatorColumns($this->name);
}
if (isset($this->fieldNames[$columnDef['name']])) {
throw MappingException::duplicateColumnName($this->name, $columnDef['name']);
}
if (!isset($columnDef['fieldName'])) {
$columnDef['fieldName'] = $columnDef['name'];
}
if (!isset($columnDef['type'])) {
$columnDef['type'] = "string";
}
if (in_array($columnDef['type'], array("boolean", "array", "object", "datetime", "time", "date"))) {
throw MappingException::invalidDiscriminatorColumnType($this->name, $columnDef['type']);
}
$this->discriminatorColumn = $columnDef;
}
}
示例2: setDiscriminatorColumn
/**
* Sets the discriminator column definition.
*
* @param array $columnDef
* @see getDiscriminatorColumn()
*/
public function setDiscriminatorColumn($columnDef)
{
if ($columnDef !== null) {
if (isset($this->fieldNames[$columnDef['name']])) {
throw MappingException::duplicateColumnName($this->name, $columnDef['name']);
}
if (!isset($columnDef['name'])) {
throw MappingException::nameIsMandatoryForDiscriminatorColumns($this->name, $columnDef);
}
if (!isset($columnDef['fieldName'])) {
$columnDef['fieldName'] = $columnDef['name'];
}
$this->discriminatorColumn = $columnDef;
}
}