Example #1
0
 /**
  * @param Storage $storage
  *
  * @return Item
  */
 public function setStorage(Storage $storage = null)
 {
     if ($this->storage !== $storage) {
         // romove link on this item for old storage
         if ($this->storage instanceof Storage) {
             $tmp = $this->storage;
             $this->storage = null;
             $tmp->removeItem($this);
         }
         $this->storage = $storage;
         // add link on this item
         if ($this->storage instanceof Storage) {
             $this->storage->addItem($this);
         }
     }
     $this->doClearPath();
     return $this;
 }