public function fetchAll() { $dbTable = $this->getDbTable(); $entries = array(); $rowSet = $dbTable->fetchAll(); if ($rowSet) { foreach ($rowSet as $row) { $variant = new Application_Model_Variants(); $variant->setId($row->id); $variant->setName($row->name); $variant->setRelationsId($row->objects_id); $entries[] = $variant; } return $entries; } else { throw new Zend_Exception('Could not get actions list!'); } }
public function getVariants($id) { $variantsMapper = new Application_Model_VariantsMapper(); $dbTable = $variantsMapper->getDbTable(); $rowSet = $dbTable->fetchAll($dbTable->select()->where('objects_id = ?', $id)); if ($rowSet) { $entries = null; foreach ($rowSet as $row) { $variant = new Application_Model_Variants(); $variant->setId($row->id); $variant->setName($row->name); $entries[] = $variant; } return $entries; } else { throw new Zend_Exception('Could not get actions list!'); } }