protected function _fetchAllIds(Garp_Model_Db $model) { $fields = array('id'); $select = $model->select()->from($model->getName(), $fields); $records = $model->fetchAll($select); return $records; }
/** * Retrieve primary keys of affected records * * @param Garp_Model_Db $model * @param String $where * @return Array */ protected function _getPrimaryKeysOfAffectedRows(Garp_Model_Db $model, $where) { if ($draftableObserver = $model->getObserver('Draftable')) { // Unregister so it doesn't screw up the upcoming fetch call $model->unregisterObserver($draftableObserver); } $pkExtractor = new Garp_Db_PrimaryKeyExtractor($model, $where); $pks = $pkExtractor->extract(); if (count($pks)) { return array($pks); } $rows = $model->fetchAll($where); $pks = array(); foreach ($rows as $row) { if (!$row->isConnected()) { $row->setTable($model); } $pks[] = (array) $row->getPrimaryKey(); } if ($draftableObserver) { $model->registerObserver($draftableObserver); } return $pks; }