예제 #1
0
파일: Base.php 프로젝트: lerre/framework
 /**
  * Find the first record that is retrieved by the given sql
  *
  * @see     Mad_Model_Base::findBySql()
  * @param   string  $sql
  * @param   array   $bindVars
  */
 protected function _findInitialBySql($sql, $bindVars)
 {
     $sql = $this->sanitizeSql($sql, $bindVars);
     $sql = $this->connection->addLimitOffset($sql, array('limit' => 1, 'offset' => 0));
     if ($row = $this->connection->selectOne($sql, "{$this->_className} Load")) {
         return $this->instantiate($row);
     } else {
         return null;
     }
 }