public function editAction() { $this->accessRights(13); //Accept Parent Module, Return Main Menu Lists with Active Menu Indicator $this->childModuleAccessRights(40, 'edit'); //Accept Child Module ID & it's Actions: add, edit, view, disable $id = (int) $this->params()->fromRoute('id', 0); try { $markethighlight = $this->getMarketHighlightTable()->getMarketHighlight($id); } catch (\Exception $ex) { return $this->redirect()->toRoute('markethighlight', array('action' => 'index')); } $form_markethighlight = new MarketHighlightForm(); $form_markethighlight->bind($markethighlight); $request = $this->getRequest(); if ($request->isPost()) { // prepare audit trail parameters $from = (array) $markethighlight; $to = $this->getRequest()->getPost()->toArray(); $diff = array_diff_assoc($to, $from); unset($diff['addbuttonmarkethighlight'], $diff['market_highlights_id']); $changes = $this->prepare_modified_data($from, $to, $diff); // end of audit trail parameters $form_markethighlight->setInputFilter($markethighlight->getInputFilter()); $form_markethighlight->setData($request->getPost()); // check if input filter passed the validation if ($form_markethighlight->isValid()) { $this->getMarketHighlightTable()->saveMarketHighlight($markethighlight); $this->save_to_audit_trail('Market Highlight for' . $to['mh_date'], $changes['pre'], $changes['post'], 'edit', 40); $this->flashMessenger()->addMessage(['content' => 'market highlight has been updated', 'type' => 'success']); } return $this->redirect()->toRoute('markethighlight'); } }