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

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

Add object types used to narrow the query. This can either be a string name representing the object type from the schema, such as 'user' or 'group' or you can pass the LdapObjectSchema for the type. If you are using this class without a schema then construct the query manually by just using the "where" and "andWhere" methods.
public from ( mixed $type, null | string $alias = null )
$type mixed The string schema type name or a LdapObjectSchema
$alias null | string The alias name to refer to the type being selected
    public function from($type, $alias = null)
    {
        $type = $this->getSchemaFromType($type);
        if (is_null($type->getFilter())) {
            throw new InvalidArgumentException(sprintf('The schema type "%s" needs a filter defined to query LDAP with it.', $type->getObjectType()));
        }
        $this->operation->getFilter()->addLdapObjectSchema($type, $alias);
        $this->hydrator->setLdapObjectSchema($type);
        return $this;
    }

Usage Example

 function it_should_set_the_ldap_type_for_the_role_query()
 {
     $this->setRoleLdapType('foo');
     $this->qb->from('foo')->shouldBeCalled()->willReturn($this->qb);
     $this->loadUserByUsername('foo');
 }
All Usage Examples Of LdapTools\Query\LdapQueryBuilder::from