LdapTools\Query\OperatorCollection::toLdapFilter PHP Метод

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

Get the LDAP filter string representation of all the operators in the collection.
public toLdapFilter ( string | null $alias = null ) : string
$alias string | null The alias to narrow the filter to.
Результат string
    public function toLdapFilter($alias = null)
    {
        if (is_null($alias) && !empty($this->aliases)) {
            $filter = $this->getLdapFilterForAliases();
        } else {
            $filter = $this->getLdapFilter($alias);
        }
        return $filter;
    }

Usage Example

Пример #1
0
 function let(LdapConnectionInterface $connection)
 {
     $attribbutes = ['defaultNamingContext' => 'dc=example,dc=local', 'configurationNamingContext' => 'cn=Configuration,dc=example,dc=local'];
     $rootDse = new LdapObject($attribbutes);
     $this->filter = new OperatorCollection();
     $this->filter->add(new Comparison('foo', '=', 'bar'));
     $this->operation = new QueryOperation($this->filter);
     $this->operation->setFilter($this->filter);
     $this->operation->setAttributes(["cn", "givenName", "foo"]);
     $op = clone $this->operation;
     $op->setFilter($this->filter->toLdapFilter());
     $connection->execute($op)->willReturn($this->ldapEntries);
     $connection->getRootDse()->willReturn($rootDse);
     $connection->getConfig()->willReturn(new DomainConfiguration('example.local'));
     $this->beConstructedWith($connection);
     $this->setQueryOperation($this->operation);
 }