本文整理汇总了PHP中Propel\Generator\Model\ForeignKey::loadMapping方法的典型用法代码示例。如果您正苦于以下问题:PHP ForeignKey::loadMapping方法的具体用法?PHP ForeignKey::loadMapping怎么用?PHP ForeignKey::loadMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\ForeignKey
的用法示例。
在下文中一共展示了ForeignKey::loadMapping方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addForeignKey
/**
* Adds a new foreign key to this table.
*
* @param ForeignKey|array $foreignKey The foreign key mapping
* @return ForeignKey
*/
public function addForeignKey($foreignKey)
{
if ($foreignKey instanceof ForeignKey) {
$fk = $foreignKey;
$fk->setTable($this);
$name = $fk->getPhpName() ?: $fk->getName();
if (isset($this->foreignKeysByName[$name])) {
throw new EngineException(sprintf('Foreign key "%s" declared twice in table "%s". Please specify a different php name!', $name, $this->getName()));
}
$this->foreignKeys[] = $fk;
$this->foreignKeysByName[$name] = $fk;
if (!in_array($fk->getForeignTableName(), $this->foreignTableNames)) {
$this->foreignTableNames[] = $fk->getForeignTableName();
}
return $fk;
}
$fk = new ForeignKey(isset($foreignKey['name']) ? $foreignKey['name'] : null);
$fk->setTable($this);
$fk->loadMapping($foreignKey);
return $this->addForeignKey($fk);
}
示例2: addForeignKey
/**
* Adds a new foreign key to this table.
*
* @param ForeignKey|array
* @return ForeignKey
*/
public function addForeignKey($fkdata)
{
if ($fkdata instanceof ForeignKey) {
$fk = $fkdata;
$fk->setTable($this);
$this->foreignKeys[] = $fk;
if (!in_array($fk->getForeignTableName(), $this->foreignTableNames)) {
$this->foreignTableNames[] = $fk->getForeignTableName();
}
return $fk;
}
$fk = new ForeignKey();
$fk->setTable($this);
$fk->loadMapping($fkdata);
return $this->addForeignKey($fk);
}