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