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()));
}
}