src/LdapTools/Utilities/ConverterUtilitiesTrait.php
protected function getCurrentLdapAttributeValue($attribute)
    {
        if (!$this->getDn() || !$this->getLdapConnection()) {
            throw new AttributeConverterException(sprintf('Unable to query for the current "%s" attribute.', $attribute));
        }

        $query = new LdapQueryBuilder($this->getLdapConnection());
        try {
            return $query->select($attribute)
                ->where($query->filter()->present('objectClass'))
                ->setBaseDn($this->getDn())
                ->setScopeBase()
                ->getLdapQuery()
                ->getSingleScalarOrNullResult();
        } catch (EmptyResultException $e) {
            throw new AttributeConverterException(sprintf('Unable to find LDAP object: %s', $this->getDn()));
        }
    }
protected function getCurrentLdapAttributeValue($attribute)
    {
        if (!$this->getDn() || !$this->getLdapConnection()) {
            throw new AttributeConverterException(sprintf('Unable to query for the current "%s" attribute.', $attribute));
        }

        $query = new LdapQueryBuilder($this->getLdapConnection());
        try {
            return $query->select($attribute)
                ->where($query->filter()->present('objectClass'))
                ->setBaseDn($this->getDn())
                ->setScopeBase()
                ->getLdapQuery()
                ->getSingleScalarOrNullResult();
        } catch (EmptyResultException $e) {
            throw new AttributeConverterException(sprintf('Unable to find LDAP object: %s', $this->getDn()));
        }
    }
protected function getCurrentLdapAttributeValue ( $ attribute ) { if ( ! $ this -> getDn ( ) || ! $ this -> getLdapConnection ( ) ) { throw new AttributeConverterException ( sprintf ( 'Unable to query for the current "%s" attribute.' , $ attribute ) ) ; } $ query = new LdapQueryBuilder ( $ this -> getLdapConnection ( ) ) ; try { return $ query -> select ( $ attribute ) -> where ( $ query -> filter ( ) -> present ( 'objectClass' ) ) -> setBaseDn ( $ this -> getDn ( ) ) -> setScopeBase ( ) -> getLdapQuery ( ) -> getSingleScalarOrNullResult ( ) ; } catch ( EmptyResultException $ e ) { throw new AttributeConverterException ( sprintf ( 'Unable to find LDAP object: %s' , $ this -> getDn ( ) ) ) ; } }
This can be called to retrieve the current value of an attribute from LDAP.

@param string $attribute The attribute name to query for a value from the converter context
@return array|string|null
@throws AttributeConverterException
This can be called to retrieve the current value of an attribute from LDAP .