/** * Sets up the FieldSelector Widget for the current view * * @param RepositoryQuery $query * @return $this */ public function setupFieldSelectorControl(RepositoryQuery $query) { if (!$this->view->compact) { $widget = new FieldSelector(); $widget->setFieldsAvailable($query->getColumns()); $this->view->fieldSelector = $widget; } return $this; }
/** * Return the name of the conversion method for the given alias or column name and context * * If a query column or a filter column, which is part of a query filter, needs to be converted, * you'll need to pass $query, otherwise the column is considered a statement column. * * @param string $table The datasource's table * @param string $name The alias or column name for which to return a conversion method * @param string $context The context of the conversion: persist or retrieve * @param RepositoryQuery $query If given the column is considered a query column, * statement column otherwise * * @return string * * @throws ProgrammingError In case a conversion rule is found but not any conversion method */ protected function getConverter($table, $name, $context, RepositoryQuery $query = null) { if ($name instanceof Zend_Db_Expr) { return; } if (!($query !== null && $this->validateQueryColumnAssociation($table, $name)) && !($query === null && $this->validateStatementColumnAssociation($table, $name))) { $table = $this->findTableName($name); if (!$table) { if ($query !== null) { // It may be an aliased Zend_Db_Expr $desiredColumns = $query->getColumns(); if (isset($desiredColumns[$name]) && $desiredColumns[$name] instanceof Zend_Db_Expr) { return; } } throw new ProgrammingError('Column name validation seems to have failed. Did you require the column?'); } } return parent::getConverter($table, $name, $context, $query); }