public function getRowCount(Collection $collection = null) { if (isset($collection)) { return $collection->count(true); } if (!isset($this->_rowCount)) { $sql = 'SELECT COUNT(*) AS count FROM ' . $this->_tableName; $connection = Db::getInstance()->getConnection(); $statement = $connection->prepare($sql); $statement->execute(); $result = $statement->fetch(PDO::FETCH_ASSOC); $this->_rowCount = $result['count']; } return $this->_rowCount; }
public function __construct(Cart $cart = null) { parent::__construct(); if (isset($cart)) { $this->setCart($cart); $this->addFilter(new Where('cart', Filter::FILTER_EQUALS, $cart->getPK())); } }
public function load() { parent::load(); if ($this->count()) { $aclTimer = Ajde::app()->addTimer("<i>ACL validation for collection</i>"); $this->validateModels(); Ajde::app()->endTimer($aclTimer); } return $this->_items; }