LdapTools\Query\LdapQueryBuilder::getLdapQuery PHP Метод

getLdapQuery() публичный Метод

Get the LdapQuery object based on the constructed filter and parameters in this builder.
public getLdapQuery ( ) : LdapQuery
Результат LdapQuery
    public function getLdapQuery()
    {
        if (!$this->connection) {
            throw new LogicException('To get a LdapQuery instance you must pass a LdapConnection to the constructor');
        }
        return (new LdapQuery($this->connection))->setQueryOperation(clone $this->operation)->setOrderBy($this->orderBy);
    }

Usage Example

Пример #1
0
 /**
  * Given an array of values and the attribute to query, get the values as represent by the attribute to select.
  *
  * @param array $values
  * @param string $toQuery
  * @param string $toSelect
  * @return array
  */
 protected function getValuesForAttribute(array $values, $toQuery, $toSelect)
 {
     $query = new LdapQueryBuilder($this->getLdapConnection());
     $or = $query->filter()->bOr();
     foreach ($values as $value) {
         $or->add($query->filter()->eq($toQuery, $value));
     }
     $query->select($toSelect)->where($or);
     return $query->getLdapQuery()->getResult();
 }