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

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

Create a logical 'and' from the passed statements. Either pass a key => value array with attribute names and expected values (which will be compared in terms of equality) or pass arbitrary Operator objects using the 'filter' method shortcuts or some other way.
public where ( $whereStatements )
$whereStatements Either a key => value array or an Operator type objects.
    public function where(...$whereStatements)
    {
        $this->addBaseAndIfNotExists();
        if (1 == count($whereStatements) && is_array($whereStatements[0])) {
            foreach ($whereStatements[0] as $attribute => $value) {
                $this->baseAnd->add($this->filterBuilder->eq($attribute, $value));
            }
        } else {
            $this->baseAnd->add(...$whereStatements);
        }
        return $this;
    }

Usage Example

 /**
  * @param \LdapTools\Bundle\LdapToolsBundle\Security\User\LdapUser $user
  */
 function it_should_refresh_a_user_by_their_guid($user)
 {
     $user->getLdapGuid()->shouldBeCalled()->willReturn($this->attr['guid']);
     $this->qb->where(['guid' => $this->attr['guid']])->shouldBeCalled()->willReturn($this->qb);
     $this->refreshUser($user)->shouldBeAnInstanceOf('\\LdapTools\\Bundle\\LdapToolsBundle\\Security\\User\\LdapUser');
 }