Fully Qualified Name: | Zend\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 Will return true if one from the "or conditions" and all from the "and condition" returns true. Otherwise false | 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 | array | |
$andFilters | array |
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 |
---|---|---|
$name | string | |
$filter | callable|\FilterInterface | |
$condition | int | Can |
Returns: \FilterComposite
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 |
---|---|---|
string | $property | Parameter |
$property |
Returns: bool
Check if $name has a filter registered
Parameter Name | Type | Description |
---|---|---|
string | $name | Identifier |
$name |
Returns: bool
Remove a filter from the composition
Parameter Name | Type | Description |
---|---|---|
string | $name | Identifier |
$name |
Returns: \FilterComposite