public function rename($rdn, $newParentDn = null, $deleteOldRdn = true)
    {
        if ($newParentDn instanceof Model) {
            $newParentDn = $newParentDn->getDn();
        }

        $moved = $this->query->getConnection()->rename($this->getDn(), $rdn, $newParentDn, $deleteOldRdn);

        if ($moved) {
            // If the model was successfully moved, we'll set its
            // new DN so we can sync it's attributes properly.
            $this->setDn("{$rdn},{$newParentDn}");

            $this->syncRaw();

            return true;
        }

        return false;
    }
public function rename($rdn, $newParentDn = null, $deleteOldRdn = true)
    {
        if ($newParentDn instanceof Model) {
            $newParentDn = $newParentDn->getDn();
        }

        $moved = $this->query->getConnection()->rename($this->getDn(), $rdn, $newParentDn, $deleteOldRdn);

        if ($moved) {
            // If the model was successfully moved, we'll set its
            // new DN so we can sync it's attributes properly.
            $this->setDn("{$rdn},{$newParentDn}");

            $this->syncRaw();

            return true;
        }

        return false;
    }
public function rename ( $ rdn , $ newParentDn = null , $ deleteOldRdn = true ) { if ( $ newParentDn instanceof Model ) { $ newParentDn = $ newParentDn -> getDn ( ) ; } $ moved = $ this -> query -> getConnection ( ) -> rename ( $ this -> getDn ( ) , $ rdn , $ newParentDn , $ deleteOldRdn ) ; if ( $ moved ) { // If the model was successfully moved, we'll set its // new DN so we can sync it's attributes properly. $ this -> setDn ( "{$rdn},{$newParentDn}" ) ; $ this -> syncRaw ( ) ; return true ; } return false ; }
Renames the current model to a new RDN and new parent.

@param string            $rdn          The models new relative distinguished name. Example: "cn=JohnDoe"
@param Model|string|null $newParentDn  The models new parent distinguished name (if moving). Leave this null if you are only renaming. Example: "ou=MovedUsers,dc=acme,dc=org"
@param bool|true         $deleteOldRdn Whether to delete the old models relative distinguished name once renamed / moved.

@return bool
Renames the current model to a new RDN and new parent .