/** * Utility function for loading a complete query from cache into objects * * @param string $cacheId The class is prepended to this id * @param object $object The object to put the data in * @param mixed $sql string or \Zend_Db_Select * @param array $binds sql paramters * @param mixed $tags atring or array of strings * @return array */ protected function _getObjectsAllCached($cacheId, $object, $sql, $binds = null, $tags = array()) { $output = array(); $rows = $this->_getSelectAllCached($cacheId, $sql, $binds, $tags); if ($rows) { $this->source->applySource($object); foreach ($rows as $row) { $tmp = clone $object; $tmp->exchangeArray($row); $output[] = $tmp; } } return $output; }
/** * Called after the check that all required registry values * have been set correctly has run. * * @return void */ public function afterRegistry() { parent::afterRegistry(); if (!$this->importer instanceof \MUtil_Model_Importer) { $this->importer = new \MUtil_Model_Importer(); $source = new \MUtil_Registry_Source(get_object_vars($this)); $source->applySource($this->importer); $this->importer->setRegistrySource($source); } if (!$this->targetModel instanceof \MUtil_Model_ModelAbstract) { if ($this->model instanceof \MUtil_Model_ModelAbstract) { $this->targetModel = $this->model; } } if ($this->targetModel instanceof \MUtil_Model_ModelAbstract) { $this->importer->setTargetModel($this->targetModel); } if ($this->sourceModel instanceof \MUtil_Model_ModelAbstract) { $this->importer->setSourceModel($this->sourceModel); } // Cleanup any references to model to avoid confusion $this->model = null; }