PHP Class LdapTools\Query\LdapQuery

Author: Chad Sikorra ([email protected])
Inheritance: use trait LdapTools\Hydrator\HydrateQueryTrait
Afficher le fichier Open project: ldaptools/ldaptools Class Usage Examples

Protected Properties

Свойство Type Description
$caseSensitive boolean
$hydratorFactory LdapTools\Factory\HydratorFactory
$ldap LdapTools\Connection\LdapConnectionInterface
$operation LdapTools\Operation\QueryOperation | null
$orderBy The attributes to order by, if any. They will be in ['attribute' => 'ASC'] form.
$schemas LdapTools\Schema\LdapObjectSchema[]

Méthodes publiques

Méthode Description
__construct ( LdapTools\Connection\LdapConnectionInterface $ldap )
execute ( string $hydratorType = HydratorFactory::TO_OBJECT ) : mixed Execute a query based on the set parameters. Optionally choose a mode to hydrate the results in.
getArrayResult ( ) : array This is an alias for the execute() method with an implied array hydration type. This executes the query against LDAP and returns the results as an array instead of objects.
getIsCaseSensitiveSort ( ) : boolean Get whether or not the results should be sorted in a case-sensitive way.
getOneOrNullResult ( string $hydratorType = HydratorFactory::TO_OBJECT ) : array | LdapObject | null This behaves very similar to getSingleResult(), only if no results are found it will return null instead of throwing an exception.
getOrderBy ( ) : array Get the attributes to order the results by.
getQueryOperation ( ) : QueryOperation | null Get the query operation that will run against LDAP.
getResult ( string $hydratorType = HydratorFactory::TO_OBJECT ) : mixed This is an alias for the execute() method. This executes the query against LDAP and returns the result.
getSingleResult ( string $hydratorType = HydratorFactory::TO_OBJECT ) : array | LdapObject Retrieve a single unique result from LDAP. If the result is empty or contains more than one entry, an exception is thrown.
getSingleScalarOrNullResult ( ) : mixed This behaves very similar to getSingleScalarResult(), only if the attribute is not found it will return null instead of throwing an exception.
getSingleScalarResult ( ) : mixed Retrieve a single selected attribute value from LDAP.
setIsCaseSensitiveSort ( boolean $caseSensitive ) Set whether or not the results should be sorted in a case-sensitive way.
setOrderBy ( array $orderBy ) Set the attributes to order the results by.
setQueryOperation ( QueryOperation $operation ) Set the query operation to run against LDAP.

Méthodes protégées

Méthode Description
getFormattedOrderBy ( $selected, $aliases ) : array This formats the orderBy array to ignore case differences between the orderBy name and the actually selected name, such as for sorting arrays.
getResultsForAliases ( string $hydratorType ) : array | LdapObjectCollection | mixed Goes through each alias for the operation to get results only for that specific type, then combine and return them all.
getResultsFromLdap ( QueryOperation $operation, string $hydratorType, null | LdapObjectSchema $schema = null, null | string $alias = null ) : mixed
getSelectedForAllAliases ( array $aliases ) : array Get all the attributes that were selected for the query taking into account all of the aliases used.
sortResults ( mixed $results ) : mixed

Method Details

__construct() public méthode

public __construct ( LdapTools\Connection\LdapConnectionInterface $ldap )
$ldap LdapTools\Connection\LdapConnectionInterface

execute() public méthode

Execute a query based on the set parameters. Optionally choose a mode to hydrate the results in.
public execute ( string $hydratorType = HydratorFactory::TO_OBJECT ) : mixed
$hydratorType string A hyrdrator type constant from the factory.
Résultat mixed

getArrayResult() public méthode

This is an alias for the execute() method with an implied array hydration type. This executes the query against LDAP and returns the results as an array instead of objects.
public getArrayResult ( ) : array
Résultat array

getFormattedOrderBy() protected méthode

This formats the orderBy array to ignore case differences between the orderBy name and the actually selected name, such as for sorting arrays.
protected getFormattedOrderBy ( $selected, $aliases ) : array
$selected
$aliases
Résultat array

getIsCaseSensitiveSort() public méthode

Get whether or not the results should be sorted in a case-sensitive way.
public getIsCaseSensitiveSort ( ) : boolean
Résultat boolean

getOneOrNullResult() public méthode

This behaves very similar to getSingleResult(), only if no results are found it will return null instead of throwing an exception.
public getOneOrNullResult ( string $hydratorType = HydratorFactory::TO_OBJECT ) : array | LdapObject | null
$hydratorType string
Résultat array | LdapTools\Object\LdapObject | null

getOrderBy() public méthode

Get the attributes to order the results by.
public getOrderBy ( ) : array
Résultat array

getQueryOperation() public méthode

Get the query operation that will run against LDAP.
public getQueryOperation ( ) : QueryOperation | null
Résultat LdapTools\Operation\QueryOperation | null

getResult() public méthode

This is an alias for the execute() method. This executes the query against LDAP and returns the result.
public getResult ( string $hydratorType = HydratorFactory::TO_OBJECT ) : mixed
$hydratorType string A hyrdrator type constant from the factory.
Résultat mixed

getResultsForAliases() protected méthode

Goes through each alias for the operation to get results only for that specific type, then combine and return them all.
protected getResultsForAliases ( string $hydratorType ) : array | LdapObjectCollection | mixed
$hydratorType string
Résultat array | LdapTools\Object\LdapObjectCollection | mixed

getResultsFromLdap() protected méthode

protected getResultsFromLdap ( QueryOperation $operation, string $hydratorType, null | LdapObjectSchema $schema = null, null | string $alias = null ) : mixed
$operation LdapTools\Operation\QueryOperation
$hydratorType string
$schema null | LdapTools\Schema\LdapObjectSchema
$alias null | string
Résultat mixed

getSelectedForAllAliases() protected méthode

Get all the attributes that were selected for the query taking into account all of the aliases used.
protected getSelectedForAllAliases ( array $aliases ) : array
$aliases array
Résultat array

getSingleResult() public méthode

Retrieve a single unique result from LDAP. If the result is empty or contains more than one entry, an exception is thrown.
public getSingleResult ( string $hydratorType = HydratorFactory::TO_OBJECT ) : array | LdapObject
$hydratorType string A hyrdrator type constant from the factory.
Résultat array | LdapTools\Object\LdapObject

getSingleScalarOrNullResult() public méthode

This behaves very similar to getSingleScalarResult(), only if the attribute is not found it will return null instead of throwing an exception.
public getSingleScalarOrNullResult ( ) : mixed
Résultat mixed

getSingleScalarResult() public méthode

Retrieve a single selected attribute value from LDAP.
public getSingleScalarResult ( ) : mixed
Résultat mixed

setIsCaseSensitiveSort() public méthode

Set whether or not the results should be sorted in a case-sensitive way.
public setIsCaseSensitiveSort ( boolean $caseSensitive )
$caseSensitive boolean

setOrderBy() public méthode

Set the attributes to order the results by.
public setOrderBy ( array $orderBy )
$orderBy array In the form of ['attribute' => 'ASC', ...]

setQueryOperation() public méthode

Set the query operation to run against LDAP.
public setQueryOperation ( QueryOperation $operation )
$operation LdapTools\Operation\QueryOperation

sortResults() protected méthode

protected sortResults ( mixed $results ) : mixed
$results mixed
Résultat mixed $results

Property Details

$caseSensitive protected_oe property

protected bool $caseSensitive
Résultat boolean

$hydratorFactory protected_oe property

protected HydratorFactory,LdapTools\Factory $hydratorFactory
Résultat LdapTools\Factory\HydratorFactory

$ldap protected_oe property

protected LdapConnectionInterface,LdapTools\Connection $ldap
Résultat LdapTools\Connection\LdapConnectionInterface

$operation protected_oe property

protected QueryOperation,LdapTools\Operation|null $operation
Résultat LdapTools\Operation\QueryOperation | null

$orderBy protected_oe property

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

$schemas protected_oe property

protected LdapObjectSchema[],LdapTools\Schema $schemas
Résultat LdapTools\Schema\LdapObjectSchema[]