예제 #1
0
 /**
  * @param AbstractItem $existedItem
  * @param array $data
  * @return AbstractItem|null
  */
 protected function _updateItem(AbstractItem $existedItem, array $data)
 {
     $previousId = $existedItem->getId();
     $foundItem = $this->_getItem($existedItem->getArrayCopy());
     if (empty($foundItem)) {
         return null;
     }
     $foundItem->update($data);
     if (isset($this->_storage[$previousId])) {
         unset($this->_storage[$previousId]);
     }
     $this->_storage[$foundItem->getId()] = $foundItem;
     return $foundItem;
 }