예제 #1
0
 public function build_sql(AbstractRelation $query)
 {
     $complete_sql = $query->complete_sql();
     $this->query = $query;
     if ($complete_sql) {
         list($sql, $params) = $complete_sql;
         array_unshift($params, $sql);
         $this->_params = $params;
         $this->will_paginate = $query->will_paginate();
     } else {
         $this->will_paginate = $query->will_paginate();
         $this->_build_sql();
     }
 }
예제 #2
0
 public function __construct(ZfSql\Sql $sql, $tableName)
 {
     parent::__construct();
     $this->sql = $sql;
     $this->tableName = $tableName;
     $this->from($this->tableName);
 }
예제 #3
0
 protected function loadRecords($select)
 {
     return parent::loadRecords($this->selectDeletedRecords($select));
 }
예제 #4
0
 /**
  * @return ActiveRecord\Collection
  */
 public static function createModelsFromQuery(AbstractRelation $query)
 {
     if ($query->will_paginate()) {
         $params = ['page' => $query->get_page(), 'perPage' => $query->get_per_page(), 'offset' => $query->get_offset(), 'totalRows' => $query->get_row_count()];
     } else {
         $params = [];
     }
     return self::_create_collection($query->get_results()->fetchAll(PDO::FETCH_ASSOC), $params);
 }