src/LdapTools/AttributeConverter/ConvertValueToDn.php
protected function getAttributeFromLdapQuery($value, $toSelect)
    {
        $query = $this->buildLdapQuery($this->options['filter'], $this->options['or_filter'], $toSelect);

        $bOr = $this->getQueryOrStatement($query, $value);
        $eq = $this->getQueryComparisonStatement($value, $query);

        if (!empty($bOr->getChildren())) {
            $bOr->add($eq);
            $query->where($bOr);
        } else {
            $query->where($eq);
        }
        $query->setBaseDn($this->options['base_dn']);

        try {
            return $query->getLdapQuery()->getSingleScalarResult();
        } catch (EmptyResultException $e) {
            throw new AttributeConverterException(sprintf(
                'Unable to convert value "%s" to a %s for attribute "%s"',
                $value,
                $toSelect,
                $this->getAttribute()
            ));
        }
    }
protected function getAttributeFromLdapQuery($value, $toSelect)
    {
        $query = $this->buildLdapQuery($this->options['filter'], $this->options['or_filter'], $toSelect);

        $bOr = $this->getQueryOrStatement($query, $value);
        $eq = $this->getQueryComparisonStatement($value, $query);

        if (!empty($bOr->getChildren())) {
            $bOr->add($eq);
            $query->where($bOr);
        } else {
            $query->where($eq);
        }
        $query->setBaseDn($this->options['base_dn']);

        try {
            return $query->getLdapQuery()->getSingleScalarResult();
        } catch (EmptyResultException $e) {
            throw new AttributeConverterException(sprintf(
                'Unable to convert value "%s" to a %s for attribute "%s"',
                $value,
                $toSelect,
                $this->getAttribute()
            ));
        }
    }
protected function getAttributeFromLdapQuery ( $ value , $ toSelect ) { $ query = $ this -> buildLdapQuery ( $ this -> options [ 'filter' ] , $ this -> options [ 'or_filter' ] , $ toSelect ) ; $ bOr = $ this -> getQueryOrStatement ( $ query , $ value ) ; $ eq = $ this -> getQueryComparisonStatement ( $ value , $ query ) ; if ( ! empty ( $ bOr -> getChildren ( ) ) ) { $ bOr -> add ( $ eq ) ; $ query -> where ( $ bOr ) ; } else { $ query -> where ( $ eq ) ; } $ query -> setBaseDn ( $ this -> options [ 'base_dn' ] ) ; try { return $ query -> getLdapQuery ( ) -> getSingleScalarResult ( ) ; } catch ( EmptyResultException $ e ) { throw new AttributeConverterException ( sprintf ( 'Unable to convert value "%s" to a %s for attribute "%s"' , $ value , $ toSelect , $ this -> getAttribute ( ) ) ) ; } }
Attempt to look-up the attribute from a LDAP query based on the value.

@param string $value
@param string $toSelect
@return string The distinguished name.
@throws AttributeConverterException
Attempt to look - up the attribute from a LDAP query based on the value .