public function destroyAction() { $this->logger->entering(); try { $this->logger->info('Getting item from Params'); $lineItems = new LineItem(); $lineItem = $lineItems->find($this->_getParam('id'))->current(); $this->logger->info('Checking Item is in owned by user'); if ($lineItem->user_id != $this->session->user_id) { throw new Exception("Line Item:{$lineItem->id} is not owned by user:{$this->session->user_id}"); } $this->logger->info('Deleting item from bag'); $lineItem->delete(); $this->logger->info('Redirecting to index'); $this->_redirect('/'); } catch (Exception $e) { $this->logger->warn($e->getMessage()); $this->flash->notice = 'Invalid Action'; $this->_redirect('/'); $this->logger->info('Clearing flash notice'); $this->flash->keep = 1; unset($this->flash->notice); } $this->logger->exiting(); }