Beispiel #1
0
 /**
  * 通过Select对象初始化
  * 
  * 需要初始化的字段:setPerpage setCurrentPage setItemCount
  *
  * @param \HuiLib\Db\Query\Select $select
  * @return \HuiLib\Db\RowSet
  */
 public function initBySelect(\HuiLib\Db\Query\Select $select)
 {
     $this->select = $select;
     $this->setPerpage($select->getLimit());
     $offset = $select->getOffset();
     $currentPage = $this->perpage ? ceil($offset / $this->perpage) + 1 : 1;
     $this->setCurrentPage($currentPage);
     $this->setItemCount($select->getItemCount());
     return $this;
 }
Beispiel #2
0
 /**
  * 通过Select对象初始化
  *
  * @param \HuiLib\Db\Query\Select $select
  * @return \HuiLib\Db\RowSet
  */
 public function initBySelect(\HuiLib\Db\Query\Select $select)
 {
     $this->select = $select;
     $this->dataList = $select->query()->fetchAll();
     return $this;
 }