Repository: Allow implementations to provide search columns

refs #9029
This commit is contained in:
Johannes Meyer 2015-08-13 14:20:21 +02:00
parent 4b6849eea7
commit 38622e96d5
1 changed files with 34 additions and 1 deletions

View File

@ -82,7 +82,7 @@ abstract class Repository implements Selectable
/**
* The filter columns being provided
*
* This might be intialized by concrete repository implementations, in the following format
* This may be intialized by concrete repository implementations, in the following format
* <pre><code>
* array(
* 'alias_or_column_name',
@ -94,6 +94,13 @@ abstract class Repository implements Selectable
*/
protected $filterColumns;
/**
* The search columns (or aliases) being provided
*
* @var array An array of strings
*/
protected $searchColumns;
/**
* The sort rules to be applied on a query
*
@ -327,6 +334,32 @@ abstract class Repository implements Selectable
return array();
}
/**
* Return the search columns being provided
*
* Calls $this->initializeSearchColumns() in case $this->searchColumns is null.
*
* @return array
*/
public function getSearchColumns()
{
if ($this->searchColumns === null) {
$this->searchColumns = $this->initializeSearchColumns();
}
return $this->searchColumns;
}
/**
* Overwrite this in your repository implementation in case you need to initialize the search columns lazily
*
* @return array
*/
protected function initializeSearchColumns()
{
return array();
}
/**
* Return the sort rules to be applied on a query
*