public function activeAction() { $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default'); $id = $this->params()->fromRoute('id'); $userDetails = $this->recoverUserDetails(); $helper = new AlboPretorioControllerHelper(); $helper->setConnection($em->getConnection()); $helper->getConnection()->beginTransaction(); try { $alboRecord = $helper->recoverWrapperRecordsById(new AlboPretorioArticoliGetterWrapper(new AlboPretorioArticoliGetter($em)), array('id' => $id, 'limit' => 1), $id); $helper->checkRecords($alboRecord, "Dati relativi all'atto non trovati"); $helper->activeAtto($id); $helper->getConnection()->commit(); $this->log(array('user_id' => $userDetails->id, 'message' => "Attivato atto albo pretorio " . $alboRecord[0]['titolo'], 'type' => 'info', 'backend' => 1, 'module_id' => ModulesContainer::albo_pretorio_id, 'reference_id' => $alboRecord[0]['id'])); $referer = $this->getRequest()->getHeader('Referer'); if (is_object($referer)) { return $this->redirect()->toUrl($referer->getUri()); } } catch (\Exception $e) { try { $helper->getConnection()->rollBack(); } catch (\Doctrine\DBAL\ConnectionException $exDb) { } $this->log(array('user_id' => $userDetails->id, 'message' => "Errore attivazione atto albo pretorio " . $alboRecord[0]['titolo'] . ' Messaggio generato: ' . $e->getMessage(), 'type' => 'error', 'backend' => 1, 'module_id' => ModulesContainer::albo_pretorio_id, 'reference_id' => $alboRecord[0]['id'])); } }