本文整理汇总了PHP中ForeignKey::getPhpName方法的典型用法代码示例。如果您正苦于以下问题:PHP ForeignKey::getPhpName方法的具体用法?PHP ForeignKey::getPhpName怎么用?PHP ForeignKey::getPhpName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ForeignKey
的用法示例。
在下文中一共展示了ForeignKey::getPhpName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFKPhpNameAffix
/**
* Gets the PHP method name affix to be used for fkeys for the current table (not referrers to this table).
*
* The difference between this method and the getRefFKPhpNameAffix() method is that in this method the
* classname in the affix is the foreign table classname.
*
* @param ForeignKey $fk The local FK that we need a name for.
* @param boolean $plural Whether the php name should be plural (e.g. initRelatedObjs() vs. addRelatedObj()
* @return string
*/
public function getFKPhpNameAffix(ForeignKey $fk, $plural = false)
{
if ($fk->getPhpName()) {
if ($plural) {
return $this->getPluralizer()->getPluralForm($fk->getPhpName());
} else {
return $fk->getPhpName();
}
} else {
$className = $this->getForeignTable($fk)->getPhpName();
if ($plural) {
$className = $this->getPluralizer()->getPluralForm($className);
}
return $className . $this->getRelatedBySuffix($fk, true);
}
}