/** * AfterFetch callback, reforms the bound Chapters into a * more concise collection. * @param Array $args Event listener parameters * @return Void */ public function afterFetch(&$args) { $results =& $args[1]; $iterator = new Garp_Db_Table_Rowset_Iterator($results, array($this, 'convertArticleLayout')); $iterator->walk(); return true; }
/** * Include preview URLs in the resultset * * @param array $args * @return void */ public function afterFetch(&$args) { $results =& $args[1]; $scaler = new Garp_Image_Scaler(); $templateUrl = (string) $scaler->getScaledUrl('%d', '%s'); $templates = array_keys(Zend_Registry::get('config')->image->template->toArray()); $iterator = new Garp_Db_Table_Rowset_Iterator($results, function ($result) use($templates, $templateUrl) { if (!isset($result->id)) { return; } $result->setVirtual('urls', array_reduce($templates, function ($acc, $cur) use($templateUrl, $result) { $acc[$cur] = sprintf($templateUrl, $cur, $result->id); return $acc; }, array())); }); $iterator->walk(); }
/** * After fetch callback * * @param Array $args * @return Void */ public function afterFetch(&$args) { $model =& $args[0]; $results =& $args[1]; $select =& $args[2]; // In the CMS environment, the translated data is merged into the parent data $isCms = Zend_Registry::isRegistered('CMS') && Zend_Registry::get('CMS'); if (!$isCms && !$this->_forceI18nOutput) { return; } $iterator = new Garp_Db_Table_Rowset_Iterator($results, array($this, 'mergeTranslatedFields')); $iterator->walk(); }