bAnd() public méthode

A logical AND operator.
public bAnd ( $op ) : bAnd
Résultat LdapTools\Query\Operator\bAnd
 /**
  * Adds a base 'bAnd' operator for the convenience 'where', 'andWhere' methods only if it does not already exist.
  *
  * @throws \LdapTools\Exception\LdapQueryException
  */
 protected function addBaseAndIfNotExists()
 {
     if (!$this->baseAnd) {
         $this->baseAnd = $this->filterBuilder->bAnd();
         $this->operation->getFilter()->add($this->baseAnd);
     }
 }
 function let(LdapConnectionInterface $connection)
 {
     $config = new Configuration();
     $domain = new DomainConfiguration('example.com');
     $domain->setServers(['example'])->setBaseDn('dc=example,dc=com')->setLazyBind(true)->setPageSize(500);
     $connection->getConfig()->willReturn($domain);
     $config->setCacheType('none');
     $parser = SchemaParserFactory::get($config->getSchemaFormat(), $config->getSchemaFolder());
     $cache = CacheFactory::get($config->getCacheType(), []);
     $dispatcher = new SymfonyEventDispatcher();
     $schemaFactory = new LdapObjectSchemaFactory($cache, $parser, $dispatcher);
     $this->fb = new FilterBuilder();
     $this->schema = $schemaFactory;
     $this->objectSchema = $schema = new LdapObjectSchema('ad', 'user');
     $this->objectSchema->setFilter($this->fb->bAnd($this->fb->eq('objectCategory', 'person'), $this->fb->eq('objectClass', 'user')));
     $this->beConstructedWith($connection, $schemaFactory);
 }
 /**
  * @param bool $value
  * @return \LdapTools\Query\Operator\BaseOperator
  */
 protected function getQueryOperator($value)
 {
     $fb = new FilterBuilder();
     if ($value) {
         $operator = $fb->bAnd($fb->gte('accountExpires', '1'), $fb->lte('accountExpires', '9223372036854775806'));
     } else {
         $operator = $fb->bOr($fb->eq('accountExpires', '0'), $fb->eq('accountExpires', self::NEVER_EXPIRES));
     }
     return $operator;
 }
 /**
  * @param array $filter
  * @param BaseOperator|null $operator
  * @return BaseOperator
  */
 protected function getOperatorForArray(array $filter, BaseOperator $operator = null)
 {
     $filter = !empty($filter) ? $this->filterBuilder->bAnd(...$this->parseFilterToOperators($filter)) : null;
     if (!$filter && !$operator) {
         throw new InvalidArgumentException(sprintf('Type "%s" for schema "%s" needs to have one of the following defined: objectClass, objectCategory, or filter.', $this->schema->getObjectType(), $this->schema->getSchemaName()));
     } elseif ($filter && $operator) {
         $operator = $this->filterBuilder->bAnd($operator, $filter);
     } else {
         $operator = $operator ?: $filter;
     }
     return $operator;
 }
 function it_should_query_results_from_multiple_schema_types($connection)
 {
     $foo = new LdapObjectSchema('foo', 'foo');
     $bar = new LdapObjectSchema('foo', 'bar');
     $foo->setFilter(new Comparison('foo', '=', 'bar'));
     $bar->setFilter(new Comparison('bar', '=', 'foo'));
     $map = ['firstName' => 'givenname', 'lastName' => 'sn', 'created' => 'whencreated', 'name' => 'cn'];
     $bar->setAttributeMap($map);
     $bar->setAttributesToSelect(['name', 'created']);
     $bar->setConverterMap(['generalized_time' => ['created']]);
     $foo->setAttributeMap($map);
     $foo->setAttributesToSelect(['firstName', 'lastName']);
     $fb = new FilterBuilder();
     $filter = new OperatorCollection();
     $filter->addLdapObjectSchema($foo);
     $filter->addLdapObjectSchema($bar);
     $filter->add($fb->bAnd($fb->startsWith('foo.firstName', 'J'), $fb->startsWith('bar.name', 'Smith'), $fb->present('lastName')));
     $this->operation->setFilter($filter);
     $this->operation->setAttributes([]);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(&(foo=bar)(&(givenname=J*)(sn=*)))' && $op->getAttributes() == ['givenname', 'sn'];
     }))->shouldBeCalled()->willReturn($this->ldapEntries);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(&(bar=foo)(&(cn=Smith*)(sn=*)))' && $op->getAttributes() == ['cn', 'whencreated'];
     }))->shouldBeCalled()->willReturn($this->sortEntries);
     $this->getResult()->count()->shouldBeEqualTo(4);
     $this->getArrayResult()->shouldHaveCount(4);
 }