/**
  * Annull atto and redirect to summary
  */
 public function annullAction()
 {
     if ($this->getServiceLocator()->get('request')->isPost()) {
         $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
         $userDetails = $this->recoverUserDetails();
         $id = $this->params()->fromPost('annullId');
         $helper = new AlboPretorioControllerHelper();
         $helper->setConnection($em->getConnection());
         $helper->getConnection()->beginTransaction();
         try {
             $record = $helper->recoverWrapperRecordsById(new AlboPretorioArticoliGetterWrapper(new AlboPretorioArticoliGetter($em)), array('id' => $id, 'limit' => 1), $id);
             $helper->annullArticle($id);
             $helper->getConnection()->commit();
             $this->log(array('user_id' => $userDetails->id, 'message' => "Pubblicato atto albo pretorio " . $record[0]['titolo'], 'type' => 'info', 'backend' => 1, 'module_id' => ModulesContainer::albo_pretorio_id, 'reference_id' => $record[0]['id']));
         } catch (\Exception $e) {
             try {
                 $helper->getConnection()->rollBack();
             } catch (\Doctrine\DBAL\ConnectionException $exDb) {
             }
             $this->log(array('user_id' => $userDetails->id, 'message' => "Errore pubblicazione atto albo pretorio " . $record[0]['titolo'] . ' Messaggio generato: ' . $e->getMessage(), 'type' => 'error', 'backend' => 1, 'module_id' => ModulesContainer::albo_pretorio_id, 'reference_id' => $record[0]['id']));
             // TODO: redirect to a message page and show an error message
         }
     }
     return $this->redirectToSummary();
 }