/** * Generate a \Dewdrop\Db\Select object for retrieving options using the * metadata of the option table. Prior to this method being called, at * least the $tableName property must be set. We will attempt to guess * the value and title columns, if they are not set, but the table is needed * to retrieve the other metadata. * * @return \Dewdrop\Db\Select */ protected function generateStmt() { $stmt = $this->dbAdapter->select(); $metadata = $this->loadTableMetadata(); $columns = $metadata['columns']; if (!$this->titleColumn) { $this->titleColumn = $this->findTitleColumnFromMetadata($columns); } if (!$this->valueColumn) { $this->valueColumn = $this->findValueColumnFromMetadata($columns); } $stmt->from($this->tableName, $this->getSelectColumns()); $this->filterStmt($columns, $stmt); $this->orderStmt($columns, $stmt); return $stmt; }
/** * Create a new \Dewdrop\Db\Select object. * * @return \Dewdrop\Db\Select */ public function select() { return $this->db->select(); }
/** * Create a Select object for use when loading filter settings from the DB. * * @return \Dewdrop\Db\Select */ protected function selectForLoad() { return $this->dbAdapter->select()->from($this->dbTableName, ['field_id'])->where('component = ?', $this->componentName); }