deleteItem() public method

Delete item
public deleteItem ( string $key ) : void
$key string
return void
Example #1
0
 /**
  * @Acl(action="delete")
  */
 public function deleteAction()
 {
     $path = $this->parsePath();
     $files = $this->_getParam('file', array());
     try {
         foreach ((array) $files as $file) {
             $key = "{$path}/{$file}";
             $this->service->deleteItem($key);
             $this->_helper->entity->flushManager();
             $this->clearCompiledTemplate($key);
             $this->_helper->flashMessenger(getGS("Template object '\$1' was deleted.", $file));
         }
     } catch (\InvalidArgumentException $e) {
         $this->_helper->flashMessenger(array('error', $e->getMessage()));
     }
     $this->_redirect(urldecode($this->_getParam('next')), array('prependBase' => false));
 }
 /**
  * @Acl(action="delete")
  */
 public function deleteAction()
 {
     $translator = \Zend_Registry::get('container')->getService('translator');
     $path = $this->parsePath();
     $files = $this->_getParam('file', array());
     try {
         foreach ((array) $files as $file) {
             $key = "{$path}/{$file}";
             $this->service->deleteItem($key);
             $this->_helper->entity->flushManager();
             $this->clearCompiledTemplate($key);
             $this->_helper->flashMessenger($translator->trans("Template object \$1 was deleted.", array('$1' => $file), 'themes'));
         }
     } catch (\InvalidArgumentException $e) {
         $this->_helper->flashMessenger(array('error', $e->getMessage()));
     }
     $this->_redirect(urldecode($this->_getParam('next')), array('prependBase' => false));
 }