db()->fetchAll($this->settings['query']); } public function listColumns() { return array_keys((array) current($this->fetchData())); } public static function addSettingsFormFields(QuickForm $form) { Util::addDbResourceFormElement($form, 'resource'); $form->addElement('textarea', 'query', array( 'label' => 'DB Query', 'required' => true, 'rows' => 15, )); return $form; } protected function db() { if ($this->db === null) { $this->db = DbConnection::fromResourceName($this->settings['resource'])->getDbAdapter(); } return $this->db; } }