Returns the current Connection instance.
public getConnection ( ) : Adldap\Connections\ConnectionInterface | ||
return | Adldap\Connections\ConnectionInterface |
/** * Moves the current model to a new RDN and new parent. * * @param string $rdn * @param string|null $newParentDn * @param bool|true $deleteOldRdn * * @return bool */ public function move($rdn, $newParentDn = null, $deleteOldRdn = true) { $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; }
/** * Deletes the current entry. * * @throws ModelNotFoundException * @throws AdldapException * * @return bool */ public function delete() { $dn = $this->getDn(); if (!$this->exists) { // Make sure the record exists before we can delete it $message = 'Model does not exist in active directory.'; throw new ModelNotFoundException($message); } elseif (is_null($dn) || empty($dn)) { // If the record exists but the DN attribute does // not exist, we can't process a delete. $message = 'Unable to delete. The current model does not have a distinguished name present.'; throw new AdldapException($message); } $deleted = $this->query->getConnection()->delete($dn); if ($deleted) { // We'll set the exists property to false on delete // so the dev can run create operations $this->exists = false; return true; } return false; }
/** * Constructor. * * @param Builder $builder */ public function __construct(Builder $builder) { $this->builder = $builder; $this->connection = $builder->getConnection(); $this->schema = $builder->getSchema(); }
/** * Moves the current model to a new RDN and new parent. * * @param string $rdn * @param string $newParentDn * @param bool|true $deleteOldRdn * * @return bool */ public function move($rdn, $newParentDn, $deleteOldRdn = true) { return $this->query->getConnection()->rename($this->getDn(), $rdn, $newParentDn, $deleteOldRdn); }