public function deleteAction()
 {
     $this->fa->readOnly();
     $id = (int) $this->getParam('id');
     $record = Journal::getRepository()->findOneBy(array('id' => $id, 'user_id' => $this->user->id));
     if (!$record instanceof Journal) {
         throw new \FA\Exception('Journal entry not found!');
     }
     $record->delete();
     $this->alert('<b>Journal deleted!</b>', 'green');
     return $this->redirectFromHere(array('action' => 'index', 'id' => NULL));
 }
 public function viewAction()
 {
     $id = (int) $this->getParam('id');
     $record = Journal::find($id);
     if (!$record instanceof Journal) {
         throw new \FA\Exception('Journal not found!');
     }
     $this->view->journal = $record;
     $this->_getUser($record->user);
     $this->_logPageView();
     $this->_enforceNoGuests();
     // TODO: Rewrite
 }