Example #1
0
 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;
 }
Example #2
0
 public function __construct(Cart $cart = null)
 {
     parent::__construct();
     if (isset($cart)) {
         $this->setCart($cart);
         $this->addFilter(new Where('cart', Filter::FILTER_EQUALS, $cart->getPK()));
     }
 }
Example #3
0
 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;
 }