public function addSelectColumns($c)
 {
     $peerClass = sfPropelFinderUtils::getPeerClassFromClass($this->getToClass());
     foreach (call_user_func(array($peerClass, 'getFieldNames'), BasePeer::TYPE_COLNAME) as $column) {
         if ($this->isAlias()) {
             $column = call_user_func(array($peerClass, 'alias'), $this->getAlias(), $column);
         }
         $c->addSelectColumn($column);
     }
     return $c;
 }
 protected function getColName($phpName, $peerClass = null, $withPeerClass = false, $autoAddJoin = true)
 {
     if (array_key_exists($phpName, $this->withColumns)) {
         return $phpName;
     }
     if (strpos($phpName, '.') !== false) {
         // Table.Column
         list($class, $phpName) = explode('.', $phpName);
         if ($this->hasRelation($class)) {
             $relation = $this->relations[$class];
             $toClass = $relation->getToClass();
             if ($toClass == $class) {
                 // Relation with no alias
                 $peerClass = sfPropelFinderUtils::getPeerClassFromClass($relation->getToClass());
             } else {
                 // Relation with an alias
                 return sfPropelFinderUtils::getColNameUsingAlias($class, $phpName, $toClass, $withPeerClass);
             }
         } elseif ($class == $this->alias) {
             $class = $this->class;
         } else {
             $peerClass = sfPropelFinderUtils::getPeerClassFromClass($class);
         }
     } else {
         if (strpos($phpName, '_') !== false) {
             // Table_Column, or Table_Name_Column, so explode is not a solution here
             $limit = strrpos($phpName, '_');
             $class = substr($phpName, 0, $limit);
             $phpName = substr($phpName, $limit + 1);
             $peerClass = sfPropelFinderUtils::getPeerClassFromClass($class);
         }
     }
     if (!$peerClass) {
         // Column
         $peerClass = $this->peerClass;
     }
     if ($peerClass != $this->peerClass && !$this->hasRelation($class) && $autoAddJoin) {
         $this->join($class);
     }
     try {
         $column = call_user_func(array($peerClass, 'translateFieldName'), ucfirst($phpName), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME);
         return $withPeerClass ? array($peerClass, $column) : $column;
     } catch (PropelException $e) {
         throw new Exception(sprintf('sfPropelFinder: %s has no %s column', $peerClass, $phpName));
     }
 }
 /**
  * Finds a relation between two classes by introspection
  * A relation is found only if the foreign key lies in the columns of the first class
  *
  * @param string $from Propel Class name (e.g. 'Article')
  * @param string $to   Propel Class name (e.g. 'Comment')
  * 
  * @return sfPropelFinderRelation A relationship, or false if no relationship is found
  */
 public function findRelation($from, $to)
 {
     $fromPeer = sfPropelFinderUtils::getPeerClassFromClass($from);
     $toPeer = sfPropelFinderUtils::getPeerClassFromClass($to);
     foreach (sfPropelFinderUtils::getColumnsForPeerClass($fromPeer) as $c) {
         if ($c->isForeignKey()) {
             if (!$this->databaseMap->containsTable($c->getRelatedTableName())) {
                 $mapBuilder = call_user_func(array($toPeer, 'getMapBuilder'));
                 $mapBuilder->doBuild();
             }
             try {
                 $tableMap = $this->databaseMap->getTable($c->getRelatedTableName());
             } catch (PropelException $e) {
                 // so $c->getRelatedTable() is not in the database map
                 // even though the $phpName table map has been initialized
                 // we are obviously looking for the wrong table here
                 continue;
             }
             if ($tableMap->getPhpName() == $to) {
                 return new sfPropelFinderRelation($from, constant($fromPeer . '::' . $c->getColumnName()), $to, $c->getRelatedName());
             }
         }
     }
     return false;
 }