getConnection() public method

Returns the current Connection instance.
public getConnection ( ) : Adldap\Connections\ConnectionInterface
return Adldap\Connections\ConnectionInterface
コード例 #1
0
ファイル: Model.php プロジェクト: adldap2/adldap2
 /**
  * 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;
 }
コード例 #2
0
ファイル: AbstractModel.php プロジェクト: samhsuqld/Adldap2
 /**
  * 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;
 }
コード例 #3
0
ファイル: Processor.php プロジェクト: adldap2/adldap2
 /**
  * Constructor.
  *
  * @param Builder $builder
  */
 public function __construct(Builder $builder)
 {
     $this->builder = $builder;
     $this->connection = $builder->getConnection();
     $this->schema = $builder->getSchema();
 }
コード例 #4
0
ファイル: AbstractModel.php プロジェクト: espinosa/Adldap2
 /**
  * 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);
 }