src/Classes/AdldapContacts.php
public function create(array $attributes)
    {
        $contact = new Contact($attributes);

        $contact->validateRequired();

        // Translate the schema
        $add = $this->adldap->ldapSchema($attributes);

        // Set the cn to the contacts display name
        $add['cn'][0] = $contact->{'display_name'};

        $add['objectclass'][0] = 'top';
        $add['objectclass'][1] = 'person';
        $add['objectclass'][2] = 'organizationalPerson';
        $add['objectclass'][3] = 'contact';

        if (!$contact->hasAttribute('exchange_hidefromlists')) {
            $add['msExchHideFromAddressLists'][0] = 'TRUE';
        }

        // Determine the container
        $attributes['container'] = array_reverse($attributes['container']);

        $container = 'OU='.implode(',OU=', $attributes['container']);

        $dn = 'CN='.$this->adldap->utilities()->escapeCharacters($add['cn'][0]).', '.$container.','.$this->adldap->getBaseDn();

        // Add the entry
        return $this->connection->add($dn, $add);
    }
public function create(array $attributes)
    {
        $contact = new Contact($attributes);

        $contact->validateRequired();

        // Translate the schema
        $add = $this->adldap->ldapSchema($attributes);

        // Set the cn to the contacts display name
        $add['cn'][0] = $contact->{'display_name'};

        $add['objectclass'][0] = 'top';
        $add['objectclass'][1] = 'person';
        $add['objectclass'][2] = 'organizationalPerson';
        $add['objectclass'][3] = 'contact';

        if (!$contact->hasAttribute('exchange_hidefromlists')) {
            $add['msExchHideFromAddressLists'][0] = 'TRUE';
        }

        // Determine the container
        $attributes['container'] = array_reverse($attributes['container']);

        $container = 'OU='.implode(',OU=', $attributes['container']);

        $dn = 'CN='.$this->adldap->utilities()->escapeCharacters($add['cn'][0]).', '.$container.','.$this->adldap->getBaseDn();

        // Add the entry
        return $this->connection->add($dn, $add);
    }
public function create ( array $ attributes ) { $ contact = new Contact ( $ attributes ) ; $ contact -> validateRequired ( ) ; // Translate the schema $ add = $ this -> adldap -> ldapSchema ( $ attributes ) ; // Set the cn to the contacts display name $ add [ 'cn' ] [ 0 ] = $ contact -> { 'display_name' } ; $ add [ 'objectclass' ] [ 0 ] = 'top' ; $ add [ 'objectclass' ] [ 1 ] = 'person' ; $ add [ 'objectclass' ] [ 2 ] = 'organizationalPerson' ; $ add [ 'objectclass' ] [ 3 ] = 'contact' ; if ( ! $ contact -> hasAttribute ( 'exchange_hidefromlists' ) ) { $ add [ 'msExchHideFromAddressLists' ] [ 0 ] = 'TRUE' ; } // Determine the container $ attributes [ 'container' ] = array_reverse ( $ attributes [ 'container' ] ) ; $ container = 'OU=' . implode ( ',OU=' , $ attributes [ 'container' ] ) ; $ dn = 'CN=' . $ this -> adldap -> utilities ( ) -> escapeCharacters ( $ add [ 'cn' ] [ 0 ] ) . ', ' . $ container . ',' . $ this -> adldap -> getBaseDn ( ) ; // Add the entry return $ this -> connection -> add ( $ dn , $ add ) ; }
Create a contact.

@param array $attributes The attributes to set to the contact

@return bool|string
Create a contact .