PHP Class Search\Manager

ファイルを表示 Open project: friendsofcake/search Class Usage Examples

Protected Properties

Property Type Description
$_collection string Active filter collection.
$_filters array Filter collection and their filters
$_repository Repository

Public Methods

Method Description
__call ( string $method, array $args ) Magic method to add filters using custom types.
__construct ( Cake\Datasource\RepositoryInterface $repository ) Constructor
add ( string $name, string $filter, array $options = [] ) Adds a new filter to the active collection.
all ( ) : array Return all configured types.
boolean ( string $name, array $config = [] ) boolean method
callback ( string $name, array $config = [] ) callback method
collection ( string | null $name = null ) : mixed Sets or gets the filter collection name.
compare ( string $name, array $config = [] ) compare method
custom ( string $name, array $config = [] ) custom method
finder ( string $name, array $config = [] ) finder method
getFilters ( string $collection = 'default' ) : array Gets all filters in a given collection.
like ( string $name, array $config = [] ) like method
loadFilter ( string $name, string $filter, array $options = [] ) : Base Loads a search filter.
remove ( string $name ) : void Removes filter from the active collection.
repository ( ) : Cake\Datasource\RepositoryInterface Return repository instance.
table ( ) : Table Return Table
value ( string $name, array $config = [] ) value method

Method Details

__call() public method

Magic method to add filters using custom types.
public __call ( string $method, array $args )
$method string Method name.
$args array Arguments.

__construct() public method

Constructor
public __construct ( Cake\Datasource\RepositoryInterface $repository )
$repository Cake\Datasource\RepositoryInterface Repository

add() public method

Adds a new filter to the active collection.
public add ( string $name, string $filter, array $options = [] )
$name string Field name.
$filter string Filter name.
$options array Filter options.

all() public method

Return all configured types.
public all ( ) : array
return array Config

boolean() public method

boolean method
public boolean ( string $name, array $config = [] )
$name string Name
$config array Config

callback() public method

callback method
public callback ( string $name, array $config = [] )
$name string Name
$config array Config

collection() public method

Sets or gets the filter collection name.
public collection ( string | null $name = null ) : mixed
$name string | null Name of the active filter collection to set.
return mixed Returns $this or the name of the active collection if no $name was provided.

compare() public method

compare method
public compare ( string $name, array $config = [] )
$name string Name
$config array Config

custom() public method

custom method
public custom ( string $name, array $config = [] )
$name string Name
$config array Config

finder() public method

finder method
public finder ( string $name, array $config = [] )
$name string Name
$config array Config

getFilters() public method

Gets all filters in a given collection.
public getFilters ( string $collection = 'default' ) : array
$collection string Name of the filter collection.
return array Array of filter instances.

like() public method

like method
public like ( string $name, array $config = [] )
$name string Name
$config array Config

loadFilter() public method

Loads a search filter.
public loadFilter ( string $name, string $filter, array $options = [] ) : Base
$name string Name of the field
$filter string Filter name
$options array Filter options.
return Search\Model\Filter\Base

remove() public method

Removes filter from the active collection.
public remove ( string $name ) : void
$name string Name of the filter to be removed.
return void

repository() public method

Return repository instance.
public repository ( ) : Cake\Datasource\RepositoryInterface
return Cake\Datasource\RepositoryInterface Repository Instance

table() public method

Return Table
Deprecation: Use repository() instead.
public table ( ) : Table
return Cake\ORM\Table Table Instance

value() public method

value method
public value ( string $name, array $config = [] )
$name string Name
$config array Config

Property Details

$_collection protected_oe property

Active filter collection.
protected string $_collection
return string

$_filters protected_oe property

Filter collection and their filters
protected array $_filters
return array

$_repository protected_oe property

Repository
protected $_repository