/**
  * All a user to add and update a feed in the application
  *
  * @return ViewModel
  */
 public function manageAction()
 {
     $formManager = $this->serviceLocator->get('FormElementManager');
     $form = $formManager->get('BabyMonitor\\Forms\\ManageRecordForm');
     $feedId = (int) $this->params()->fromRoute('id');
     if ($this->getRequest()->isGet()) {
         if (!empty($feedId)) {
             if ($feed = $this->_feedTable->fetchById($feedId)) {
                 $form->setData($feed->getArrayCopy());
             } else {
                 $this->flashMessenger()->addInfoMessage('Unable to find that feed. Perhaps a new one?');
                 return $this->redirect()->toRoute(self::DEFAULT_ROUTE, array('action' => 'manage'));
             }
         }
     }
     if ($this->getRequest()->isPost()) {
         $form->setData($this->getRequest()->getPost());
         if ($form->isValid()) {
             $feed = new FeedModel();
             $feed->exchangeArray($form->getData());
             $this->_feedTable->save($feed);
             if (!is_null($this->_cache)) {
                 $this->_cache->removeItem(self::KEY_ALL_RESULTS);
             }
             $this->getEventManager()->trigger('Feed.Modify', $this, array('feedData' => $feed));
             return $this->redirect()->toRoute(self::DEFAULT_ROUTE, array());
         }
     }
     return new ViewModel(array('form' => $form, 'cancelTitle' => $feedId ? "Don't update the record" : "Don't create the record", 'messages' => array('info' => $this->flashMessenger()->hasInfoMessages())));
 }
 /**
  * Remove an item.
  *
  * @param  string $cacheId
  *
  * @return bool
  */
 public function removeItem($cacheId)
 {
     $cacheId = $this->normalizeKey($cacheId);
     try {
         return $this->cache->removeItem($cacheId);
     } catch (ZendException\ExceptionInterface $ex) {
         return false;
     }
 }
 /**
  * Remove an item from the cache
  * @param string $key
  * @return boolean
  */
 public function clearItem($key)
 {
     //check if caching is enabled
     $arr_config = $this->getServiceLocator()->get("config");
     if ($arr_config["front_end_application_config"]["cache_enabled"] == FALSE) {
         return FALSE;
     }
     //end if
     //adjust key
     $key = $this->setIdentifier($key);
     $this->storageFactory->removeItem($key);
 }
Exemple #4
0
 /**
  * Remove an item.
  *
  * @param  string $key
  * @return bool
  * @throws Exception\ExceptionInterface
  *
  * @triggers removeItem.pre(PreEvent)
  * @triggers removeItem.post(PostEvent)
  * @triggers removeItem.exception(ExceptionEvent)
  */
 public function removeItem($key)
 {
     $options = $this->getOptions();
     if ($options->getWritable() && $options->getClearStatCache()) {
         clearstatcache();
     }
     return parent::removeItem($key);
 }
Exemple #5
0
 /**
  * Remove an item.
  *
  * Options:
  *  - namespace <string> optional
  *    - The namespace to use (Default: namespace of object)
  *  - ignore_missing_items <boolean> optional
  *    - Throw exception on missing item
  *
  * @param  string $key
  * @param  array  $options
  * @return boolean
  * @throws Exception\ExceptionInterface
  *
  * @triggers removeItem.pre(PreEvent)
  * @triggers removeItem.post(PostEvent)
  * @triggers removeItem.exception(ExceptionEvent)
  */
 public function removeItem($key, array $options = array())
 {
     $baseOptions = $this->getOptions();
     if ($baseOptions->getWritable() && $baseOptions->getClearStatCache()) {
         clearstatcache();
     }
     return parent::removeItem($key, $options);
 }