Adldap\Query\Builder::getDn PHP Method

getDn() public method

Returns the builders DN to perform searches upon.
public getDn ( ) : string
return string
    public function getDn()
    {
        return $this->dn;
    }

Usage Example

Example #1
0
 /**
  * Creates the entry in LDAP.
  *
  * @return bool
  */
 public function create()
 {
     if (empty($this->getDn())) {
         // If the model doesn't currently have a DN,
         // we'll create a new one automatically.
         $dn = $this->getDnBuilder();
         // We'll set the base of the DN to the query's base DN.
         $dn->setBase($this->query->getDn());
         // Then we'll add the entry's common name attribute.
         $dn->addCn($this->getCommonName());
         // Set the new DN.
         $this->setDn($dn);
     }
     // Create the entry.
     $created = $this->query->getConnection()->add($this->getDn(), $this->getAttributes());
     if ($created) {
         // If the entry was created we'll re-sync
         // the models attributes from AD.
         $this->syncRaw();
         return true;
     }
     return false;
 }