src/LdapTools/Hydrator/OperationHydrator.php
protected function setDnToUse(AddOperation $operation)
    {
        // If the DN was explicitly set, don't do anything.
        if ($operation->getDn()) {
            return;
        }
        if (!$this->schema) {
            throw new LogicException("You must explicitly set the DN or specify a schema type.");
        }
        $location = $operation->getLocation() ?: $this->schema->getDefaultContainer();
        if (empty($location)) {
            throw new LogicException('You must specify a container or OU to place this LDAP object in.');
        }
        // Handles a possible multi-valued RDN, where each RDN is pieced together with a '+'
        $rdn = implode('+', array_map(function($rdn) use ($operation) {
            return $rdn.'='.LdapUtilities::escapeValue($operation->getAttributes()[$rdn], null, LDAP_ESCAPE_DN);
        }, $this->getRdnFromAttributes(array_keys($operation->getAttributes()))));
        $operation->setDn($rdn.','.$this->resolveParameters(['container' => $location])['container']);
    }
protected function setDnToUse(AddOperation $operation)
    {
        // If the DN was explicitly set, don't do anything.
        if ($operation->getDn()) {
            return;
        }
        if (!$this->schema) {
            throw new LogicException("You must explicitly set the DN or specify a schema type.");
        }
        $location = $operation->getLocation() ?: $this->schema->getDefaultContainer();
        if (empty($location)) {
            throw new LogicException('You must specify a container or OU to place this LDAP object in.');
        }
        // Handles a possible multi-valued RDN, where each RDN is pieced together with a '+'
        $rdn = implode('+', array_map(function($rdn) use ($operation) {
            return $rdn.'='.LdapUtilities::escapeValue($operation->getAttributes()[$rdn], null, LDAP_ESCAPE_DN);
        }, $this->getRdnFromAttributes(array_keys($operation->getAttributes()))));
        $operation->setDn($rdn.','.$this->resolveParameters(['container' => $location])['container']);
    }
protected function setDnToUse ( AddOperation $ operation ) { // If the DN was explicitly set, don't do anything. if ( $ operation -> getDn ( ) ) { return ; } if ( ! $ this -> schema ) { throw new LogicException ( "You must explicitly set the DN or specify a schema type." ) ; } $ location = $ operation -> getLocation ( ) ? : $ this -> schema -> getDefaultContainer ( ) ; if ( empty ( $ location ) ) { throw new LogicException ( 'You must specify a container or OU to place this LDAP object in.' ) ; } // Handles a possible multi-valued RDN, where each RDN is pieced together with a '+' $ rdn = implode ( '+' , array_map ( function ( $ rdn ) use ( $ operation ) { return $ rdn . '=' . LdapUtilities :: escapeValue ( $ operation -> getAttributes ( ) [ $ rdn ] , null , LDAP_ESCAPE_DN ) ; } , $ this -> getRdnFromAttributes ( array_keys ( $ operation -> getAttributes ( ) ) ) ) ) ; $ operation -> setDn ( $ rdn . ',' . $ this -> resolveParameters ( [ 'container' => $ location ] ) [ 'container' ] ) ; }
Builds the DN based off of the "name" attribute. The name attribute should be mapped to the "cn" attribute in
pretty much all cases except for creating an OU object. Then the "name" attribute should be mapped to "ou".

@param AddOperation $operation
Builds the DN based off of the name attribute . The name attribute should be mapped to the cn attribute in pretty much all cases except for creating an OU object . Then the name attribute should be mapped to ou .