objectClass() public method

The list of classes from which this class is derived.
public objectClass ( ) : string
return string
Example #1
0
 /**
  * Returns the root DSE record.
  *
  * @return RootDse|null
  */
 public function getRootDse()
 {
     $root = $this->query->newInstance()->setDn(null)->read(true)->whereHas($this->schema->objectClass())->first();
     if ($root instanceof Model) {
         return (new RootDse([], $this->query))->setRawAttributes($root->getAttributes());
     }
 }
Example #2
0
 /**
  * Returns a new LDAP Entry instance.
  *
  * @param array $attributes
  *
  * @return Entry
  */
 public function newLdapEntry(array $attributes = [])
 {
     $attribute = $this->schema->objectClass();
     if (array_key_exists($attribute, $attributes) && array_key_exists(0, $attributes[$attribute])) {
         // Retrieve all of the object classes from the LDAP
         // entry and lowercase them for comparisons.
         $classes = array_map('strtolower', $attributes[$attribute]);
         // Retrieve the model mapping.
         $models = $this->map();
         // Retrieve the object class mappings (with strtolower keys).
         $mappings = array_map('strtolower', array_keys($models));
         // Retrieve the model from the map using the entry's object class.
         $map = array_intersect($mappings, $classes);
         if (count($map) > 0) {
             // Retrieve the model using the object class.
             $model = $models[current($map)];
             // Construct and return a new model.
             return $this->newModel([], $model)->setRawAttributes($attributes);
         }
     }
     // A default entry model if the object category isn't found.
     return $this->newModel()->setRawAttributes($attributes);
 }
Example #3
0
 /**
  * Finds a record by its distinguished name.
  *
  * Fails upon no records returned.
  *
  * @param string       $dn
  * @param array|string $columns
  *
  * @throws ModelNotFoundException
  *
  * @return Model
  */
 public function findByDnOrFail($dn, $columns = [])
 {
     return $this->setDn($dn)->read(true)->whereHas($this->schema->objectClass())->firstOrFail($columns);
 }
Example #4
0
 /**
  * Creates a new computer instance.
  *
  * @param array $attributes
  *
  * @return Computer
  */
 public function computer(array $attributes = [])
 {
     return (new Computer($attributes, $this->query))->setAttribute($this->schema->objectClass(), [$this->schema->top(), $this->schema->person(), $this->schema->organizationalPerson(), $this->schema->user(), $this->schema->computer()]);
 }