PHP 클래스 Search\Model\Behavior\SearchBehavior

상속: extends Cake\ORM\Behavior
파일 보기 프로젝트 열기: friendsofcake/search

공개 프로퍼티들

프로퍼티 타입 설명
$_manager Search\Manager Search Manager instance.

보호된 프로퍼티들

프로퍼티 타입 설명
$_defaultConfig array ### Options - searchConfigMethod Method name of the method that returns the filters.
$_isSearch boolean Internal flag to check whether the behavior modified the query.

공개 메소드들

메소드 설명
filterParams ( array $params ) : array Returns search params nested in array with key _search for passing as options to find method.
findSearch ( Query $query, array $options ) : Query Callback fired from the controller.
isSearch ( ) : boolean Returns true if the findSearch call modified the query in a way that at least one search filter has been applied.
searchManager ( ) : Manager Returns the search filter manager.

보호된 메소드들

메소드 설명
_extractParams ( array $params, Base[] $filters ) : array Extracts all parameters for wich a filter with a matching field name exists.
_flattenParams ( array $params ) : array Flattens a parameters array, so that possible aliased parameter keys that are provided in a nested fashion, are being grouped using flat keys.
_getAllFilters ( string | null $collection = 'default' ) : Base[] Gets all filters by the default or given collection from the search manager
_processFilters ( Base[] $filters, array $params, Query $query ) : Query Processes the given filters.

메소드 상세

_extractParams() 보호된 메소드

Extracts all parameters for wich a filter with a matching field name exists.
protected _extractParams ( array $params, Base[] $filters ) : array
$params array The parameters array to extract from.
$filters Search\Model\Filter\Base[] The filters to match against.
리턴 array The extracted parameters.

_flattenParams() 보호된 메소드

### Example: The following parameters array: [ 'Alias' => [ 'field' => 'value' 'otherField' => [ 'value', 'otherValue' ] ], 'field' => 'value' ] would return as [ 'Alias.field' => 'value', 'Alias.otherField' => [ 'value', 'otherValue' ], 'field' => 'value' ]
protected _flattenParams ( array $params ) : array
$params array The parameters array to flatten.
리턴 array The flattened parameters array.

_getAllFilters() 보호된 메소드

Gets all filters by the default or given collection from the search manager
protected _getAllFilters ( string | null $collection = 'default' ) : Base[]
$collection string | null name of collection
리턴 Search\Model\Filter\Base[] An array of filters for the defined fields.

_processFilters() 보호된 메소드

Processes the given filters.
protected _processFilters ( Base[] $filters, array $params, Query $query ) : Query
$filters Search\Model\Filter\Base[] The filters to process.
$params array The parameters to pass to the filters.
$query Cake\ORM\Query The query to pass to the filters.
리턴 Cake\ORM\Query The query processed by the filters.

filterParams() 공개 메소드

Returns search params nested in array with key _search for passing as options to find method.
사용 중단: 2.0.0 You can directly call find like `find('search', ['search' => $this->request->query])`
public filterParams ( array $params ) : array
$params array A key value list of search parameters to use for a search.
리턴 array

findSearch() 공개 메소드

Callback fired from the controller.
public findSearch ( Query $query, array $options ) : Query
$query Cake\ORM\Query Query.
$options array The options for the find. - `search`: Array of search arguments. - `collection`: Filter collection name.
리턴 Cake\ORM\Query The Query object used in pagination.

isSearch() 공개 메소드

Returns true if the findSearch call modified the query in a way that at least one search filter has been applied.
public isSearch ( ) : boolean
리턴 boolean

searchManager() 공개 메소드

Returns the search filter manager.
public searchManager ( ) : Manager
리턴 Search\Manager

프로퍼티 상세

$_defaultConfig 보호되어 있는 프로퍼티

### Options - searchConfigMethod Method name of the method that returns the filters.
protected array $_defaultConfig
리턴 array

$_isSearch 보호되어 있는 프로퍼티

Internal flag to check whether the behavior modified the query.
protected bool $_isSearch
리턴 boolean

$_manager 공개적으로 프로퍼티

Search Manager instance.
public Manager,Search $_manager
리턴 Search\Manager