Exemple #1
0
 /**
  * Insert a plain join SQL string
  * 
  * @param string $tableName
  * @param FindCriteria $criteria
  * @param String $tableAlias
  * @param String $type INNER or LEFT etc.
  * 
  * @return FindParams 
  */
 public function join($tableName, $criteria, $tableAlias = false, $type = 'INNER')
 {
     if (!isset($this->_params['join'])) {
         $this->_params['join'] = '';
     } else {
         $this->_params['join'] .= "\n";
     }
     $this->_params['join'] .= "{$type} JOIN `{$tableName}` ";
     if ($tableAlias) {
         $this->_params['join'] .= $tableAlias . ' ';
     }
     $this->_params['join'] .= ' ON (' . $criteria->getCondition() . ')';
     //add the bind params to the main criteria object.
     $this->getCriteria()->addParams($criteria->getParams());
     //register join so activerecord can check if it needs to join the acl table
     if (!isset($this->_params['joinedTables'])) {
         $this->_params['joinedTables'] = array();
     }
     $this->_params['joinedTables'][$tableName] = $tableAlias;
     return $this;
 }