本文整理匯總了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;
}
}