示例#1
0
 /**
  * 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);
     }
 }