本文整理汇总了PHP中ForeignKey::getRefPhpName方法的典型用法代码示例。如果您正苦于以下问题:PHP ForeignKey::getRefPhpName方法的具体用法?PHP ForeignKey::getRefPhpName怎么用?PHP ForeignKey::getRefPhpName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ForeignKey
的用法示例。
在下文中一共展示了ForeignKey::getRefPhpName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRefFKPhpNameAffix
/**
* Gets the PHP method name affix to be used for referencing foreign key methods and variable names (e.g. set????(), $coll???).
*
* The difference between this method and the getFKPhpNameAffix() method is that in this method the
* classname in the affix is the classname of the local fkey table.
*
* @param ForeignKey $fk The referrer 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 getRefFKPhpNameAffix(ForeignKey $fk, $plural = false)
{
if ($fk->getRefPhpName()) {
if ($plural) {
return $this->getPluralizer()->getPluralForm($fk->getRefPhpName());
} else {
return $fk->getRefPhpName();
}
} else {
$className = $fk->getTable()->getPhpName();
if ($plural) {
$className = $this->getPluralizer()->getPluralForm($className);
}
return $className . $this->getRelatedBySuffix($fk);
}
}