示例#1
0
 /**
  * Get the column constant name (e.g. PeerName::COLUMN_NAME).
  *
  * @param      Column $col The column we need a name for.
  * @param      string $classname The Peer classname to use.
  *
  * @return     string If $classname is provided, then will return $classname::COLUMN_NAME; if not, then the peername is looked up for current table to yield $currTablePeer::COLUMN_NAME.
  */
 public function getColumnConstant($col, $classname = null)
 {
     if ($col === null) {
         $e = new Exception("No col specified.");
         print $e;
         throw $e;
     }
     if ($classname === null) {
         return $this->getBuildProperty('classPrefix') . $col->getConstantName();
     }
     // was it overridden in schema.xml ?
     if ($col->getPeerName()) {
         $const = strtoupper($col->getPeerName());
     } else {
         $const = strtoupper($col->getName());
     }
     return $classname . '::' . $const;
 }
示例#2
0
 /** 
  * Get the column constant name (e.g. PeerName::COLUMN_NAME).
  * 
  * @param Column $col The column we need a name for.
  * @param string $phpName The PHP Name of the peer class. The 'Peer' is appended automatically.
  * 
  * @return string If $phpName is provided, then will return {$phpName}Peer::COLUMN_NAME; if not, then uses current table COLUMN_NAME.
  */
 public function getColumnConstant($col, $phpName = null)
 {
     if ($col === null) {
         $e = new Exception("No col specified.");
         print $e;
         throw $e;
     }
     $classname = $this->getPeerClassname($phpName);
     // was it overridden in schema.xml ?
     if ($col->getPeerName()) {
         $const = strtoupper($col->getPeerName());
     } else {
         $const = strtoupper($col->getName());
     }
     return $classname . '::' . $const;
 }
示例#3
0
 /**
  * COMPATIBILITY: Get the column constant name (e.g. PeerName::COLUMN_NAME).
  *
  * This method exists simply because it belonged to the 'PeerBuilder' that this
  * class is replacing (because of name conflict more than actual functionality overlap).
  * When the new builder model is finished this method will be removed.
  *
  * @param      Column $col The column we need a name for.
  * @param      string $phpName The PHP Name of the peer class. The 'Peer' is appended automatically.
  *
  * @return     string If $phpName is provided, then will return {$phpName}Peer::COLUMN_NAME; if not, just COLUMN_NAME.
  * @deprecated
  */
 public static function getColumnName(Column $col, $phpName = null)
 {
     // was it overridden in schema.xml ?
     if ($col->getPeerName()) {
         $const = strtoupper($col->getPeerName());
     } else {
         $const = strtoupper($col->getName());
     }
     if ($phpName !== null) {
         return $phpName . 'Peer::' . $const;
     } else {
         return $const;
     }
 }