PHP Class Adldap\Query\Builder

Afficher le fichier Open project: adldap2/adldap2 Class Usage Examples

Méthodes publiques

Свойство Type Description
$paginated boolean Determines whether the current query is paginated.

Protected Properties

Свойство Type Description
$bindings array The query bindings.
$connection Adldap\Connections\ConnectionInterface The current connection instance.
$dn string | null The distinguished name to perform searches upon.
$grammar Grammar The current grammar instance.
$raw boolean Determines whether or not to return LDAP results in their raw array format.
$read boolean Determines whether or not to search LDAP on the base scope.
$recursive boolean Determines whether or not to search LDAP recursively.
$schema Adldap\Schemas\SchemaInterface The current schema instance.
$sortByDirection string The direction to sort the results by.
$sortByField string The field to sort search results by.
$sortByFlags integer The sort flags for sorting query results.

Méthodes publiques

Méthode Description
__call ( string $method, array $parameters ) : mixed Handle dynamic method calls on the query builder object to be directed to the query processor.
__construct ( Adldap\Connections\ConnectionInterface $connection, Grammar $grammar, Adldap\Schemas\SchemaInterface $schema = null ) Constructor.
addBinding ( Adldap\Query\Bindings\AbstractBinding $value, string $type = 'where' ) : Builder Adds a binding to the current query.
clearBindings ( ) : Builder Clears all query bindings.
dynamicWhere ( string $method, string $parameters ) Handles dynamic "where" clauses to the query.
find ( string $anr, array | string $columns = [] ) : mixed Finds a record using ambiguous name resolution.
findBaseDn ( ) : string | boolean Finds the Base DN of your domain controller.
findBy ( string $attribute, string $value, array | string $columns = [] ) : mixed Finds a record by the specified attribute and value.
findByDn ( string | array $dn, array | string $columns = [] ) : boolean | Model Finds a record by its distinguished name.
findByDnOrFail ( string $dn, array | string $columns = [] ) : Model Finds a record by its distinguished name.
findByOrFail ( string $attribute, string $value, array | string $columns = [] ) : mixed Finds a record by the specified attribute and value.
findBySid ( string $sid, array | string $columns = [] ) : mixed Finds a record by its Object SID.
findMany ( array $anrs = [], array $columns = [] ) : mixed Finds multiple records using ambiguous name resolution.
findManyBy ( string $attribute, array $values = [], array $columns = [] ) : mixed Finds many records by the specified attribute.
findOrFail ( string $anr, array | string $columns = [] ) : mixed Finds a record using ambiguous name resolution. If a record is not found, an exception is thrown.
first ( array | string $columns = [] ) : Model | array | null Returns the first entry in a search result.
firstOrFail ( array | string $columns = [] ) : Model Returns the first entry in a search result.
get ( ) : Collection | array Returns the current query.
getBindings ( ) : array Returns all of the query builder bindings.
getConnection ( ) : Adldap\Connections\ConnectionInterface Returns the current Connection instance.
getDn ( ) : string Returns the builders DN to perform searches upon.
getFilters ( ) : array Returns the filters on the current builder.
getGrammar ( ) : Grammar Returns the current Grammar instance.
getOrWheres ( ) : array Returns the or wheres on the current builder.
getQuery ( ) : string Compiles and returns the current query string.
getSchema ( ) : Adldap\Schemas\SchemaInterface Returns the current schema.
getSelects ( ) : array Returns the current selected fields to retrieve.
getSortByDirection ( ) : string Returns the query builders sort by direction.
getSortByField ( ) : string Returns the query builders sort by field.
getSortByFlags ( ) : integer Returns the query builders sort by flags.
getUnescapedQuery ( ) : string Returns the unescaped query.
getWheres ( ) : array Returns the wheres on the current builder.
hasSelects ( ) : boolean Returns true / false depending if the current object contains selects.
in ( string $dn ) : Builder Alias for setting the base DN of the query.
isPaginated ( ) : boolean Returns bool that determines whether the current query builder will return paginated results.
isRaw ( ) : boolean Returns bool that determines whether the current query builder will return raw results.
isSorted ( ) : boolean Returns bool that determines whether the current query builder will return sorted results.
newInstance ( ) : Builder Returns a new Query Builder instance.
orWhere ( string $field, string | null $operator = null, string | null $value = null ) : Builder Adds an or where clause to the current query.
orWhereApproximatelyEquals ( string $field, string $value ) : Builder Adds a or where approximately equals clause to the current query.
orWhereContains ( string $field, string $value ) : Builder Adds an or where contains clause to the current query.
orWhereEndsWith ( string $field, string $value ) : Builder Adds an or where ends with clause to the current query.
orWhereEquals ( string $field, string $value ) : Builder Adds an or where equals clause to the current query.
orWhereHas ( string $field ) : Builder Adds an or where has clause to the current query.
orWhereNotContains ( string $field, string $value ) : Builder Adds an or where *not* contains clause to the current query.
orWhereNotEndsWith ( string $field, string $value ) : Builder Adds an or where *not* ends with clause to the current query.
orWhereNotHas ( string $field ) : Builder Adds a where not has clause to the current query.
orWhereNotStartsWith ( string $field, string $value ) : Builder Adds an or where *not* starts with clause to the current query.
orWhereStartsWith ( string $field, string $value ) : Builder Adds an or where starts with clause to the current query.
paginate ( integer $perPage = 50, integer $currentPage, boolean $isCritical = true ) : Paginator | boolean Paginates the current LDAP query.
query ( string $query ) : Collection | array Performs the specified query on the current LDAP connection.
raw ( boolean $raw = true ) : Builder Sets the recursive property to tell the search whether or not to return the LDAP results in their raw format.
rawFilter ( array | string $filters = [] ) : Builder Adds a raw filter to the current query.
read ( boolean $read = true ) : Builder Sets the recursive property to tell the search whether or not to search on the base scope and return a single entry.
recursive ( boolean $recursive = true ) : Builder Sets the recursive property to tell the search whether or not to search recursively.
select ( array | string $fields = [] ) : Builder Adds the inserted fields to query on the current LDAP connection.
setConnection ( Adldap\Connections\ConnectionInterface $connection ) : Builder Sets the current connection.
setDn ( string | null $dn = null ) : Builder Sets the DN to perform searches upon.
setGrammar ( Grammar $grammar ) : Builder Sets the current filter grammar.
setSchema ( Adldap\Schemas\SchemaInterface $schema = null ) : Builder Sets the current schema.
sortBy ( string $field, string $direction = 'asc', integer | null $flags = null ) : Builder Sorts the LDAP search results by the specified field and direction.
where ( string | array $field, string $operator = null, string $value = null, string $type = 'and' ) : Builder Adds a where clause to the current query.
whereApproximatelyEquals ( string $field, string $value ) : Builder Adds a where approximately equals clause to the current query.
whereContains ( string $field, string $value ) : Builder Adds a where contains clause to the current query.
whereDisabled ( ) : Builder Adds a disabled filter to the current query.
whereEnabled ( ) : Builder Adds a enabled filter to the current query.
whereEndsWith ( string $field, string $value ) : Builder Adds a where ends with clause to the current query.
whereEquals ( string $field, string $value ) : Builder Adds a where equals clause to the current query.
whereHas ( string $field ) : Builder Adds a where has clause to the current query.
whereNotContains ( string $field, string $value ) : Builder Adds a where contains clause to the current query.
whereNotHas ( string $field ) : Builder Adds a where not has clause to the current query.
whereNotStartsWith ( string $field, string $value ) : Builder Adds a where *not* starts with clause to the current query.
whereStartsWith ( string $field, string $value ) : Builder Adds a where starts with clause to the current query.

Méthodes protégées

Méthode Description
addDynamic ( string $segment, string $connector, array $parameters, integer $index ) : void Add a single dynamic where clause statement to the query.
newProcessor ( ) : Processor Returns a new query Processor instance.
newWhereBinding ( string $field, string $operator, string | null $value = null, string $type = 'and' ) : Where | Adldap\Query\Bindings\OrWhere Constructs a new where binding depending on the specified type.

Method Details

__call() public méthode

Handle dynamic method calls on the query builder object to be directed to the query processor.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
Résultat mixed

__construct() public méthode

Constructor.
public __construct ( Adldap\Connections\ConnectionInterface $connection, Grammar $grammar, Adldap\Schemas\SchemaInterface $schema = null )
$connection Adldap\Connections\ConnectionInterface
$grammar Grammar
$schema Adldap\Schemas\SchemaInterface

addBinding() public méthode

Adds a binding to the current query.
public addBinding ( Adldap\Query\Bindings\AbstractBinding $value, string $type = 'where' ) : Builder
$value Adldap\Query\Bindings\AbstractBinding
$type string
Résultat Builder

addDynamic() protected méthode

Add a single dynamic where clause statement to the query.
protected addDynamic ( string $segment, string $connector, array $parameters, integer $index ) : void
$segment string
$connector string
$parameters array
$index integer
Résultat void

clearBindings() public méthode

Clears all query bindings.
public clearBindings ( ) : Builder
Résultat Builder

dynamicWhere() public méthode

Handles dynamic "where" clauses to the query.
public dynamicWhere ( string $method, string $parameters )
$method string
$parameters string

find() public méthode

Finds a record using ambiguous name resolution.
public find ( string $anr, array | string $columns = [] ) : mixed
$anr string
$columns array | string
Résultat mixed

findBaseDn() public méthode

Finds the Base DN of your domain controller.
public findBaseDn ( ) : string | boolean
Résultat string | boolean

findBy() public méthode

Finds a record by the specified attribute and value.
public findBy ( string $attribute, string $value, array | string $columns = [] ) : mixed
$attribute string
$value string
$columns array | string
Résultat mixed

findByDn() public méthode

Finds a record by its distinguished name.
public findByDn ( string | array $dn, array | string $columns = [] ) : boolean | Model
$dn string | array
$columns array | string
Résultat boolean | Adldap\Models\Model

findByDnOrFail() public méthode

Fails upon no records returned.
public findByDnOrFail ( string $dn, array | string $columns = [] ) : Model
$dn string
$columns array | string
Résultat Adldap\Models\Model

findByOrFail() public méthode

If no record is found an exception is thrown.
public findByOrFail ( string $attribute, string $value, array | string $columns = [] ) : mixed
$attribute string
$value string
$columns array | string
Résultat mixed

findBySid() public méthode

Finds a record by its Object SID.
public findBySid ( string $sid, array | string $columns = [] ) : mixed
$sid string
$columns array | string
Résultat mixed

findMany() public méthode

Finds multiple records using ambiguous name resolution.
public findMany ( array $anrs = [], array $columns = [] ) : mixed
$anrs array
$columns array
Résultat mixed

findManyBy() public méthode

Finds many records by the specified attribute.
public findManyBy ( string $attribute, array $values = [], array $columns = [] ) : mixed
$attribute string
$values array
$columns array
Résultat mixed

findOrFail() public méthode

Finds a record using ambiguous name resolution. If a record is not found, an exception is thrown.
public findOrFail ( string $anr, array | string $columns = [] ) : mixed
$anr string
$columns array | string
Résultat mixed

first() public méthode

Returns the first entry in a search result.
public first ( array | string $columns = [] ) : Model | array | null
$columns array | string
Résultat Adldap\Models\Model | array | null

firstOrFail() public méthode

If no entry is found, an exception is thrown.
public firstOrFail ( array | string $columns = [] ) : Model
$columns array | string
Résultat Adldap\Models\Model

get() public méthode

Returns the current query.
public get ( ) : Collection | array
Résultat Illuminate\Support\Collection | array

getBindings() public méthode

Returns all of the query builder bindings.
public getBindings ( ) : array
Résultat array

getConnection() public méthode

Returns the current Connection instance.
public getConnection ( ) : Adldap\Connections\ConnectionInterface
Résultat Adldap\Connections\ConnectionInterface

getDn() public méthode

Returns the builders DN to perform searches upon.
public getDn ( ) : string
Résultat string

getFilters() public méthode

Returns the filters on the current builder.
public getFilters ( ) : array
Résultat array

getGrammar() public méthode

Returns the current Grammar instance.
public getGrammar ( ) : Grammar
Résultat Grammar

getOrWheres() public méthode

Returns the or wheres on the current builder.
public getOrWheres ( ) : array
Résultat array

getQuery() public méthode

Compiles and returns the current query string.
public getQuery ( ) : string
Résultat string

getSchema() public méthode

Returns the current schema.
public getSchema ( ) : Adldap\Schemas\SchemaInterface
Résultat Adldap\Schemas\SchemaInterface

getSelects() public méthode

Returns the current selected fields to retrieve.
public getSelects ( ) : array
Résultat array

getSortByDirection() public méthode

Returns the query builders sort by direction.
public getSortByDirection ( ) : string
Résultat string

getSortByField() public méthode

Returns the query builders sort by field.
public getSortByField ( ) : string
Résultat string

getSortByFlags() public méthode

Returns the query builders sort by flags.
public getSortByFlags ( ) : integer
Résultat integer

getUnescapedQuery() public méthode

Returns the unescaped query.
public getUnescapedQuery ( ) : string
Résultat string

getWheres() public méthode

Returns the wheres on the current builder.
public getWheres ( ) : array
Résultat array

hasSelects() public méthode

Returns true / false depending if the current object contains selects.
public hasSelects ( ) : boolean
Résultat boolean

in() public méthode

Alias for setting the base DN of the query.
public in ( string $dn ) : Builder
$dn string
Résultat Builder

isPaginated() public méthode

Returns bool that determines whether the current query builder will return paginated results.
public isPaginated ( ) : boolean
Résultat boolean

isRaw() public méthode

Returns bool that determines whether the current query builder will return raw results.
public isRaw ( ) : boolean
Résultat boolean

isSorted() public méthode

Returns bool that determines whether the current query builder will return sorted results.
public isSorted ( ) : boolean
Résultat boolean

newInstance() public méthode

Returns a new Query Builder instance.
public newInstance ( ) : Builder
Résultat Builder

newProcessor() protected méthode

Returns a new query Processor instance.
protected newProcessor ( ) : Processor
Résultat Processor

newWhereBinding() protected méthode

Constructs a new where binding depending on the specified type.
protected newWhereBinding ( string $field, string $operator, string | null $value = null, string $type = 'and' ) : Where | Adldap\Query\Bindings\OrWhere
$field string
$operator string
$value string | null
$type string
Résultat Adldap\Query\Bindings\Where | Adldap\Query\Bindings\OrWhere

orWhere() public méthode

Adds an or where clause to the current query.
public orWhere ( string $field, string | null $operator = null, string | null $value = null ) : Builder
$field string
$operator string | null
$value string | null
Résultat Builder

orWhereApproximatelyEquals() public méthode

Adds a or where approximately equals clause to the current query.
public orWhereApproximatelyEquals ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

orWhereContains() public méthode

Adds an or where contains clause to the current query.
public orWhereContains ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

orWhereEndsWith() public méthode

Adds an or where ends with clause to the current query.
public orWhereEndsWith ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

orWhereEquals() public méthode

Adds an or where equals clause to the current query.
public orWhereEquals ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

orWhereHas() public méthode

Adds an or where has clause to the current query.
public orWhereHas ( string $field ) : Builder
$field string
Résultat Builder

orWhereNotContains() public méthode

Adds an or where *not* contains clause to the current query.
public orWhereNotContains ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

orWhereNotEndsWith() public méthode

Adds an or where *not* ends with clause to the current query.
public orWhereNotEndsWith ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

orWhereNotHas() public méthode

Adds a where not has clause to the current query.
public orWhereNotHas ( string $field ) : Builder
$field string
Résultat Builder

orWhereNotStartsWith() public méthode

Adds an or where *not* starts with clause to the current query.
public orWhereNotStartsWith ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

orWhereStartsWith() public méthode

Adds an or where starts with clause to the current query.
public orWhereStartsWith ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

paginate() public méthode

Paginates the current LDAP query.
public paginate ( integer $perPage = 50, integer $currentPage, boolean $isCritical = true ) : Paginator | boolean
$perPage integer
$currentPage integer
$isCritical boolean
Résultat Adldap\Objects\Paginator | boolean

query() public méthode

Performs the specified query on the current LDAP connection.
public query ( string $query ) : Collection | array
$query string
Résultat Illuminate\Support\Collection | array

raw() public méthode

Sets the recursive property to tell the search whether or not to return the LDAP results in their raw format.
public raw ( boolean $raw = true ) : Builder
$raw boolean
Résultat Builder

rawFilter() public méthode

Adds a raw filter to the current query.
public rawFilter ( array | string $filters = [] ) : Builder
$filters array | string
Résultat Builder

read() public méthode

Sets the recursive property to tell the search whether or not to search on the base scope and return a single entry.
public read ( boolean $read = true ) : Builder
$read boolean
Résultat Builder

recursive() public méthode

Sets the recursive property to tell the search whether or not to search recursively.
public recursive ( boolean $recursive = true ) : Builder
$recursive boolean
Résultat Builder

select() public méthode

Adds the inserted fields to query on the current LDAP connection.
public select ( array | string $fields = [] ) : Builder
$fields array | string
Résultat Builder

setConnection() public méthode

Sets the current connection.
public setConnection ( Adldap\Connections\ConnectionInterface $connection ) : Builder
$connection Adldap\Connections\ConnectionInterface
Résultat Builder

setDn() public méthode

Sets the DN to perform searches upon.
public setDn ( string | null $dn = null ) : Builder
$dn string | null
Résultat Builder

setGrammar() public méthode

Sets the current filter grammar.
public setGrammar ( Grammar $grammar ) : Builder
$grammar Grammar
Résultat Builder

setSchema() public méthode

Sets the current schema.
public setSchema ( Adldap\Schemas\SchemaInterface $schema = null ) : Builder
$schema Adldap\Schemas\SchemaInterface
Résultat Builder

sortBy() public méthode

Sorts the LDAP search results by the specified field and direction.
public sortBy ( string $field, string $direction = 'asc', integer | null $flags = null ) : Builder
$field string
$direction string
$flags integer | null
Résultat Builder

where() public méthode

Adds a where clause to the current query.
public where ( string | array $field, string $operator = null, string $value = null, string $type = 'and' ) : Builder
$field string | array
$operator string
$value string
$type string
Résultat Builder

whereApproximatelyEquals() public méthode

Adds a where approximately equals clause to the current query.
public whereApproximatelyEquals ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

whereContains() public méthode

Adds a where contains clause to the current query.
public whereContains ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

whereDisabled() public méthode

Adds a disabled filter to the current query.
public whereDisabled ( ) : Builder
Résultat Builder

whereEnabled() public méthode

Adds a enabled filter to the current query.
public whereEnabled ( ) : Builder
Résultat Builder

whereEndsWith() public méthode

Adds a where ends with clause to the current query.
public whereEndsWith ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

whereEquals() public méthode

Adds a where equals clause to the current query.
public whereEquals ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

whereHas() public méthode

Adds a where has clause to the current query.
public whereHas ( string $field ) : Builder
$field string
Résultat Builder

whereNotContains() public méthode

Adds a where contains clause to the current query.
public whereNotContains ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

whereNotHas() public méthode

Adds a where not has clause to the current query.
public whereNotHas ( string $field ) : Builder
$field string
Résultat Builder

whereNotStartsWith() public méthode

Adds a where *not* starts with clause to the current query.
public whereNotStartsWith ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

whereStartsWith() public méthode

Adds a where starts with clause to the current query.
public whereStartsWith ( string $field, string $value ) : Builder
$field string
$value string
Résultat Builder

Property Details

$bindings protected_oe property

The query bindings.
protected array $bindings
Résultat array

$connection protected_oe property

The current connection instance.
protected ConnectionInterface,Adldap\Connections $connection
Résultat Adldap\Connections\ConnectionInterface

$dn protected_oe property

The distinguished name to perform searches upon.
protected string|null $dn
Résultat string | null

$grammar protected_oe property

The current grammar instance.
protected Grammar,Adldap\Query $grammar
Résultat Grammar

$paginated public_oe property

Determines whether the current query is paginated.
public bool $paginated
Résultat boolean

$raw protected_oe property

Determines whether or not to return LDAP results in their raw array format.
protected bool $raw
Résultat boolean

$read protected_oe property

Determines whether or not to search LDAP on the base scope.
protected bool $read
Résultat boolean

$recursive protected_oe property

Determines whether or not to search LDAP recursively.
protected bool $recursive
Résultat boolean

$schema protected_oe property

The current schema instance.
protected SchemaInterface,Adldap\Schemas $schema
Résultat Adldap\Schemas\SchemaInterface

$sortByDirection protected_oe property

The direction to sort the results by.
protected string $sortByDirection
Résultat string

$sortByField protected_oe property

The field to sort search results by.
protected string $sortByField
Résultat string

$sortByFlags protected_oe property

The sort flags for sorting query results.
protected int $sortByFlags
Résultat integer