/**
* Given a value try to determine how to get its full distinguished name.
*
* @param string $value
* @return string $dn
* @throws AttributeConverterException
*/
protected function getDnFromValue($value)
{
$options = $this->getOptionsArray();
$toSelect = isset($options['select']) ? $options['select'] : 'dn';
if ($value instanceof LdapObject && !$value->has($toSelect)) {
throw new AttributeConverterException(sprintf('The LdapObject must have a "%s" defined when used in "%s".', $toSelect, $this->getAttribute()));
} elseif ($value instanceof LdapObject) {
$value = $value->get($toSelect);
} elseif (!LdapUtilities::isValidLdapObjectDn($value) && !is_null($this->getLdapConnection())) {
$value = $this->getAttributeFromLdapQuery($value, $toSelect);
}
return $value;
}