Doctrine/Subscriber/LdapObjectSubscriber.php
protected function setLdapValueForProperty(\ReflectionProperty $property, LdapObjectAnnotation $annotation, $entity)
    {
        $value = $property->getValue($entity);

        if ($value instanceof LdapObject) {
            $ldapValues = $value->get($annotation->id);
        } elseif ($value instanceof LdapObjectCollection) {
            $ldapValues = [];
            foreach ($value->toArray() as $ldapObject) {
                $ldapValues[] = $ldapObject->get($annotation->id);
            }
        } else {
            throw new \InvalidArgumentException(sprintf(
                'Class "%s" is not valid. Expected a LdapObject or LdapObjectCollection',
                get_class($value)
            ));
        }

        $property->setValue($entity, $ldapValues);
    }
protected function setLdapValueForProperty(\ReflectionProperty $property, LdapObjectAnnotation $annotation, $entity)
    {
        $value = $property->getValue($entity);

        if ($value instanceof LdapObject) {
            $ldapValues = $value->get($annotation->id);
        } elseif ($value instanceof LdapObjectCollection) {
            $ldapValues = [];
            foreach ($value->toArray() as $ldapObject) {
                $ldapValues[] = $ldapObject->get($annotation->id);
            }
        } else {
            throw new \InvalidArgumentException(sprintf(
                'Class "%s" is not valid. Expected a LdapObject or LdapObjectCollection',
                get_class($value)
            ));
        }

        $property->setValue($entity, $ldapValues);
    }
Get the specified ID for each LDAP object and save it to an array.

@param \ReflectionProperty $property
@param LdapObjectAnnotation $annotation
@param $entity