コード例 #1
0
ファイル: Collection.php プロジェクト: EricHogue/Koryukan
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct($data, $modelClassName)
 {
     $this->_modelClassName = $modelClassName;
     if (true === $data instanceof Doctrine_Query) {
         $this->_cacheKey = sha1($data->getSqlQuery() . serialize($data->getParams()));
         $cache = Zend_Registry::get('mainCache');
         if ($cache->test($this->_cacheKey)) {
             $this->_loadFromCache($cache);
         } else {
             $this->_dbData = $data->execute();
             $this->_saveInCache($cache);
         }
     } else {
         $this->_dbData = $data;
     }
     $this->_iterator = $this->_dbData->getIterator();
 }
コード例 #2
0
ファイル: Chunk.php プロジェクト: juokaz/php-examples
 /**
  * Get collection iterator
  *
  * @return Iterator
  */
 protected function getIterator()
 {
     $query = clone $this->q;
     $this->_collection = $query->offset($this->offset)->execute();
     return $this->_collection->getIterator();
 }