LdapTools\Hydrator\LdapObjectHydrator::hydrateToLdap PHP Method

hydrateToLdap() public method

public hydrateToLdap ( $ldapObject, $dn = null )
    public function hydrateToLdap($ldapObject, $dn = null)
    {
        if (!$ldapObject instanceof LdapObject) {
            throw new \InvalidArgumentException('Expects a LdapObject instance to convert batch modifications to LDAP.');
        }
        if (!$this->schema) {
            return $ldapObject->getBatchCollection()->getBatchArray();
        }
        $batches = $this->convertValuesToLdap($ldapObject->getBatchCollection(), $ldapObject->get('dn'));
        foreach ($batches as $batch) {
            /** @var \LdapTools\BatchModify\Batch $batch */
            $batch->setAttribute($this->schema->getAttributeToLdap($batch->getAttribute()));
        }
        return $batches->getBatchArray();
    }