Esempio n. 1
0
 /**
  * Manually add an object to the list
  *
  * @param ModelInterface $obj The object to add.
  * @return \Charcoal\Collection (Chainable)
  */
 public function add(ModelInterface $obj)
 {
     $this->objects[] = $obj;
     $this->map[$obj->id()] = $obj;
     // Chainable
     return $this;
 }
 /**
  * Filter the object before its assigned to the row.
  *
  * This method is useful for classes using this trait.
  *
  * @param  ModelInterface $object           The current row's object.
  * @param  array          $objectProperties The $object's display properties.
  * @return array
  */
 protected function parseObjectRow(ModelInterface $object, array $objectProperties)
 {
     return ['object' => $object, 'objectId' => $object->id(), 'objectProperties' => $objectProperties];
 }
 /**
  * Add an object to the cache store.
  *
  * @param ModelInterface $obj The object to store.
  * @return HierarchicalInterface Chainable
  */
 private function addObjectToCache(ModelInterface $obj)
 {
     static::$objectCache[$this->objType()][$obj->id()] = $obj;
     return $this;
 }