PHP Class LdapTools\Query\LdapQueryBuilder

Author: Chad Sikorra ([email protected])
Afficher le fichier Open project: ldaptools/ldaptools Class Usage Examples

Protected Properties

Свойство Type Description
$baseAnd The base 'And' operator when the method 'where' or 'andWhere' is used.
$baseOr The base 'Or' operator when the method 'orWhere' is used.
$connection The LDAP connection.
$filterBuilder LdapTools\Query\Builder\FilterBuilder | LdapTools\Query\Builder\ADFilterBuilder
$hydrator LdapTools\Hydrator\OperationHydrator
$operation The operation that will eventually be sent to the LDAP connection.
$orderBy The attributes to order by, if any. They will be in ['attribute' => 'ASC'] form.
$schemaFactory LdapTools\Factory\LdapObjectSchemaFactory

Méthodes publiques

Méthode Description
__call ( string $method, array $arguments ) : mixed Determines which function, if any, should be called.
__construct ( LdapTools\Connection\LdapConnectionInterface $connection = null, LdapObjectSchemaFactory $schemaFactory = null )
add ( variadic $operators ) Add an operator object to the query.
addControl ( variadic $controls ) Add LDAP controls to be used for the query.
addOrderBy ( string $attribute, string $direction ) Add an attribute to be ordered for the returned results and set the direction for the ordering.
andWhere ( $whereStatements ) Adds additional operators or equality comparisons to the 'and' statement.
filter ( ) : FilterBuilder | ADFilterBuilder Call this to help build additional query statements in an object-oriented fashion.
from ( mixed $type, null | string $alias = null ) Add object types used to narrow the query. This can either be a string name representing the object type from the schema, such as 'user' or 'group' or you can pass the LdapObjectSchema for the type. If you are using this class without a schema then construct the query manually by just using the "where" and "andWhere" methods.
fromGroups ( string | null $alias = null ) A convenience method to select from group object types.
fromOUs ( string | null $alias = null ) A convenience method to select from OU object types.
fromUsers ( string | null $alias = null ) A convenience method to select from user object types.
getAttributes ( ) : array Get the attributes selected for this query.
getBaseDn ( ) : string Get the base DN for the query.
getLdapFilter ( ) : string Get the LDAP filter formed by this query.
getLdapQuery ( ) : LdapQuery Get the LdapQuery object based on the constructed filter and parameters in this builder.
getPageSize ( ) : integer Get the page size for the query.
getScope ( ) : string Get the scope for the query (ie. subtree, onelevel, base).
getServer ( ) : null | string Get the specific LDAP server that the query should be run on, if any is set.
getSizeLimit ( ) : integer Get the size limit for the amount of results returned from LDAP for the query.
getUsePaging ( ) : boolean Get whether or not paging should be used for the query.
orWhere ( $whereStatements ) Create a logical 'or' from the passed arguments. Either pass a key => value array with attribute names and expected values (which will be compared in terms of equality) or pass arbitrary Operator objects using the 'filter' method shortcuts or some other way.
orderBy ( string $attribute, string $direction ) Set the attribute to order by. This will override anything already explicitly set to be ordered. To order on multiple attributes use 'addOrderBy', which allows the attribute ordering to stack.
select ( string | array $attributes = [] ) Set the attributes to select from the object. Either specify a single attribute as a string or an array of attribute names.
setBaseDn ( string $baseDn ) Sets the base DN for the query.
setPageSize ( integer $pageSize ) Set the page size for the query.
setScope ( string $scope ) Set the scope using the QueryOperation::SCOPE constant.
setScopeBase ( ) Set the scope of the query to only the entry defined by the baseDn.
setScopeOneLevel ( ) Set the scope of the query to search only the entries within the baseDn but none of its children.
setScopeSubTree ( ) Set the scope of the query to search the complete the baseDn and all children.
setServer ( string $server ) Set a specific LDAP server to run the query on.
setSizeLimit ( integer $sizeLimit ) Set the size limit for the amount of results returned from LDAP for the query.
setUsePaging ( boolean $usePaging ) Set whether or not paging should be used for the query.
toLdapFilter ( ) : string Get the LDAP filter formed by this query.
where ( $whereStatements ) Create a logical 'and' from the passed statements. Either pass a key => value array with attribute names and expected values (which will be compared in terms of equality) or pass arbitrary Operator objects using the 'filter' method shortcuts or some other way.

Méthodes protégées

Méthode Description
addBaseAndIfNotExists ( ) Adds a base 'bAnd' operator for the convenience 'where', 'andWhere' methods only if it does not already exist.
addBaseOrIfNotExists ( ) Adds a base 'bOr' operator for the convenience 'orWhere' method only if it does not already exist.
getSchemaFromType ( string | LdapObjectSchema $type ) : LdapObjectSchema

Method Details

__call() public méthode

Determines which function, if any, should be called.
public __call ( string $method, array $arguments ) : mixed
$method string
$arguments array
Résultat mixed

__construct() public méthode

public __construct ( LdapTools\Connection\LdapConnectionInterface $connection = null, LdapObjectSchemaFactory $schemaFactory = null )
$connection LdapTools\Connection\LdapConnectionInterface
$schemaFactory LdapTools\Factory\LdapObjectSchemaFactory

add() public méthode

Add an operator object to the query.
public add ( variadic $operators )
$operators variadic

addBaseAndIfNotExists() protected méthode

Adds a base 'bAnd' operator for the convenience 'where', 'andWhere' methods only if it does not already exist.
protected addBaseAndIfNotExists ( )

addBaseOrIfNotExists() protected méthode

Adds a base 'bOr' operator for the convenience 'orWhere' method only if it does not already exist.
protected addBaseOrIfNotExists ( )

addControl() public méthode

Add LDAP controls to be used for the query.
public addControl ( variadic $controls )
$controls variadic

addOrderBy() public méthode

Add an attribute to be ordered for the returned results and set the direction for the ordering.
public addOrderBy ( string $attribute, string $direction )
$attribute string The attribute name
$direction string Either 'ASC' or 'DESC'. Defaults to 'ASC'.

andWhere() public méthode

Adds additional operators or equality comparisons to the 'and' statement.
See also: where
public andWhere ( $whereStatements )
$whereStatements Either a key => value array or an Operator type objects.

filter() public méthode

Call this to help build additional query statements in an object-oriented fashion.
public filter ( ) : FilterBuilder | ADFilterBuilder
Résultat LdapTools\Query\Builder\FilterBuilder | LdapTools\Query\Builder\ADFilterBuilder

from() public méthode

Add object types used to narrow the query. This can either be a string name representing the object type from the schema, such as 'user' or 'group' or you can pass the LdapObjectSchema for the type. If you are using this class without a schema then construct the query manually by just using the "where" and "andWhere" methods.
public from ( mixed $type, null | string $alias = null )
$type mixed The string schema type name or a LdapObjectSchema
$alias null | string The alias name to refer to the type being selected

fromGroups() public méthode

A convenience method to select from group object types.
public fromGroups ( string | null $alias = null )
$alias string | null

fromOUs() public méthode

A convenience method to select from OU object types.
public fromOUs ( string | null $alias = null )
$alias string | null

fromUsers() public méthode

A convenience method to select from user object types.
public fromUsers ( string | null $alias = null )
$alias string | null

getAttributes() public méthode

Get the attributes selected for this query.
public getAttributes ( ) : array
Résultat array

getBaseDn() public méthode

Get the base DN for the query.
public getBaseDn ( ) : string
Résultat string

getLdapFilter() public méthode

Get the LDAP filter formed by this query.
Deprecation: This will be removed in a future version. Use the "toLdapFilter()" method instead.
public getLdapFilter ( ) : string
Résultat string

getLdapQuery() public méthode

Get the LdapQuery object based on the constructed filter and parameters in this builder.
public getLdapQuery ( ) : LdapQuery
Résultat LdapQuery

getPageSize() public méthode

Get the page size for the query.
public getPageSize ( ) : integer
Résultat integer

getSchemaFromType() protected méthode

protected getSchemaFromType ( string | LdapObjectSchema $type ) : LdapObjectSchema
$type string | LdapTools\Schema\LdapObjectSchema
Résultat LdapTools\Schema\LdapObjectSchema

getScope() public méthode

Get the scope for the query (ie. subtree, onelevel, base).
public getScope ( ) : string
Résultat string

getServer() public méthode

Get the specific LDAP server that the query should be run on, if any is set.
public getServer ( ) : null | string
Résultat null | string

getSizeLimit() public méthode

Get the size limit for the amount of results returned from LDAP for the query.
public getSizeLimit ( ) : integer
Résultat integer

getUsePaging() public méthode

Get whether or not paging should be used for the query.
public getUsePaging ( ) : boolean
Résultat boolean

orWhere() public méthode

Create a logical 'or' from the passed arguments. Either pass a key => value array with attribute names and expected values (which will be compared in terms of equality) or pass arbitrary Operator objects using the 'filter' method shortcuts or some other way.
public orWhere ( $whereStatements )
$whereStatements Either a key => value array or an Operator type objects.

orderBy() public méthode

Set the attribute to order by. This will override anything already explicitly set to be ordered. To order on multiple attributes use 'addOrderBy', which allows the attribute ordering to stack.
public orderBy ( string $attribute, string $direction )
$attribute string The attribute name
$direction string Either 'ASC' or 'DESC'. Defaults to 'ASC'.

select() public méthode

Set the attributes to select from the object. Either specify a single attribute as a string or an array of attribute names.
public select ( string | array $attributes = [] )
$attributes string | array

setBaseDn() public méthode

Sets the base DN for the query.
public setBaseDn ( string $baseDn )
$baseDn string

setPageSize() public méthode

Set the page size for the query.
public setPageSize ( integer $pageSize )
$pageSize integer

setScope() public méthode

Set the scope using the QueryOperation::SCOPE constant.
public setScope ( string $scope )
$scope string

setScopeBase() public méthode

Set the scope of the query to only the entry defined by the baseDn.
public setScopeBase ( )

setScopeOneLevel() public méthode

Set the scope of the query to search only the entries within the baseDn but none of its children.
public setScopeOneLevel ( )

setScopeSubTree() public méthode

Set the scope of the query to search the complete the baseDn and all children.
public setScopeSubTree ( )

setServer() public méthode

Set a specific LDAP server to run the query on.
public setServer ( string $server )
$server string

setSizeLimit() public méthode

Set the size limit for the amount of results returned from LDAP for the query.
public setSizeLimit ( integer $sizeLimit )
$sizeLimit integer

setUsePaging() public méthode

Set whether or not paging should be used for the query.
public setUsePaging ( boolean $usePaging )
$usePaging boolean

toLdapFilter() public méthode

Get the LDAP filter formed by this query.
public toLdapFilter ( ) : string
Résultat string

where() public méthode

Create a logical 'and' from the passed statements. Either pass a key => value array with attribute names and expected values (which will be compared in terms of equality) or pass arbitrary Operator objects using the 'filter' method shortcuts or some other way.
public where ( $whereStatements )
$whereStatements Either a key => value array or an Operator type objects.

Property Details

$baseAnd protected_oe property

The base 'And' operator when the method 'where' or 'andWhere' is used.
protected $baseAnd

$baseOr protected_oe property

The base 'Or' operator when the method 'orWhere' is used.
protected $baseOr

$connection protected_oe property

The LDAP connection.
protected $connection

$filterBuilder protected_oe property

protected FilterBuilder,LdapTools\Query\Builder|ADFilterBuilder,LdapTools\Query\Builder $filterBuilder
Résultat LdapTools\Query\Builder\FilterBuilder | LdapTools\Query\Builder\ADFilterBuilder

$hydrator protected_oe property

protected OperationHydrator,LdapTools\Hydrator $hydrator
Résultat LdapTools\Hydrator\OperationHydrator

$operation protected_oe property

The operation that will eventually be sent to the LDAP connection.
protected $operation

$orderBy protected_oe property

The attributes to order by, if any. They will be in ['attribute' => 'ASC'] form.
protected $orderBy

$schemaFactory protected_oe property

protected LdapObjectSchemaFactory,LdapTools\Factory $schemaFactory
Résultat LdapTools\Factory\LdapObjectSchemaFactory