The following matching rules exists:
- equals: One of the attributes values is exactly $value.
Please note that case sensitiviness depends on the
attributes syntax configured in the server.
- begins: One of the attributes values must begin with $value.
- ends: One of the attributes values must end with $value.
- contains: One of the attributes values must contain $value.
- present | any: The attribute can contain any value but must exist.
- greater: The attributes value is greater than $value.
- less: The attributes value is less than $value.
- greaterOrEqual: The attributes value is greater or equal than $value.
- lessOrEqual: The attributes value is less or equal than $value.
- approx: One of the attributes values is similar to $value.
If $escape is set to true then $value will be escaped. If set to false
then $value will be treaten as a raw filter value string. You should
then escape it yourself using {@link Horde_Ldap_Util::escapeFilterValue()}.
Examples:
This will find entries that contain an attribute "sn" that ends with
"foobar":
$filter = Horde_Ldap_Filter::create('sn', 'ends', 'foobar');
This will find entries that contain an attribute "sn" that has any
value set:
$filter = Horde_Ldap_Filter::create('sn', 'any');
public static create ( string $attribute, string $match, string $value = '', boolean $escape = true ) : Horde_Ldap_Filter | ||
$attribute | string | Name of the attribute the filter should apply to. |
$match | string | Matching rule (equals, begins, ends, contains, greater, less, greaterOrEqual, lessOrEqual, approx, any). |
$value | string | If given, then this is used as a filter value. |
$escape | boolean | Should $value be escaped? |
return | Horde_Ldap_Filter |