setOptions($options); $this->init(); } /** * @param array $options * @throws Exception * @return void */ protected function setOptions(array $options) { if (array_key_exists('options', $options)) { unset($options['options']); } foreach ($options as $name => $value) { $method = 'set' . ucfirst($name); if (is_callable([$this, $method])) { $this->$method($value); } else { throw new Exception('"' . $name . '" option is not supported'); } } } /** * @return void */ protected function init() { } protected function setDb(Zend_Db_Adapter_Pdo_Mysql $db) { $this->db = $db; return $this; } public function find(array $key) { return $this->getTable()->searchBy($key); } }