コード例 #1
0
ファイル: Model.php プロジェクト: rotexsoft/leanorm
 /**
  * 
  * {@inheritDoc}
  */
 public function fetchPairs(array $params = array())
 {
     if (array_key_exists('cols', $params) && (!is_array($params['cols']) || count($params['cols']) < 2)) {
         //throw Exception
         $msg = "ERROR: Bad param entry. Array (with at least two items) " . "expected as the value of the item with the key named 'cols'" . " in the array: " . PHP_EOL . var_export($params, true) . PHP_EOL . " passed to " . get_class($this) . '::' . __FUNCTION__ . '(...).' . PHP_EOL;
         throw new ModelBadFetchParamsSuppliedException($msg);
     }
     $query_obj = $this->_buildFetchQueryObjectFromParams($params);
     $sql = $query_obj->__toString();
     $params_2_bind_2_sql = $query_obj->getBindValues();
     return $this->_db_connector->dbFetchPairs($sql, $params_2_bind_2_sql);
 }