Fully Qualified Name: | Laminas\Hydrator\Filter\FilterComposite |
Implements: | FilterInterface |
Name | Description | Defined By |
---|---|---|
__construct() | We can pass a list of OR/AND filters through construct | FilterComposite |
addFilter() | Add a filter to the composite. Has to be indexed with $name in order to identify a specific filter. | FilterComposite |
filter() | Filter the composite based on the AND and OR condition | FilterComposite |
hasFilter() | Check if $name has a filter registered | FilterComposite |
removeFilter() | Remove a filter from the composition | FilterComposite |
We can pass a list of OR/AND filters through construct
Parameter Name | Type | Description |
---|---|---|
$orFilters | callable[]|\FilterInterface[] | |
$andFilters | callable[]|\FilterInterface[] |
Returns:
Add a filter to the composite. Has to be indexed with $name in order to identify a specific filter.
This example will exclude all methods from the hydration, that starts with 'getService'
$composite->addFilter('exclude',
function ($method) {
if (preg_match('/^getService/', $method) {
return false;
}
return true;
}, FilterComposite::CONDITION_AND
);
Parameter Name | Type | Description |
---|---|---|
$filter | callable|\FilterInterface | |
$condition | int | Can |
$name |
Returns:
Filter the composite based on the AND and OR condition
Will return true if one from the "or conditions" and all from the "and condition" returns true. Otherwise false
Parameter Name | Type | Description |
---|---|---|
$property | string | Parameter |
Returns:
Check if $name has a filter registered
Parameter Name | Type | Description |
---|---|---|
$name |
Returns:
Remove a filter from the composition
Parameter Name | Type | Description |
---|---|---|
$name |
Returns: