improve php syntax

This commit is contained in:
Julien Fastré 2015-06-24 00:17:54 +02:00
parent adf1a5eb2c
commit b264ceeaa8

View File

@ -241,7 +241,7 @@ class ReportController extends Controller
$person = $em->getRepository('ChillPersonBundle:Person') $person = $em->getRepository('ChillPersonBundle:Person')
->find($person_id); ->find($person_id);
if($person === NULL OR $cFGroup === NULL) { if($person === NULL || $cFGroup === NULL) {
throw $this->createNotFoundException(); throw $this->createNotFoundException();
} }
@ -319,7 +319,7 @@ class ReportController extends Controller
$entity = $em->getRepository('ChillReportBundle:Report')->find($report_id); $entity = $em->getRepository('ChillReportBundle:Report')->find($report_id);
if (!$entity OR !$person) { if (!$entity || !$person) {
throw $this->createNotFoundException( throw $this->createNotFoundException(
$this->get('translator')->trans('Unable to find this report.')); $this->get('translator')->trans('Unable to find this report.'));
} }
@ -349,7 +349,7 @@ class ReportController extends Controller
} }
if(intval($person_id) !== intval($report->getPerson()->getId())) { if(intval($person_id) !== intval($report->getPerson()->getId())) {
throw new Exception( throw new \RuntimeException(
$this->get('translator')->trans('This is not the report of the person.'), 1); $this->get('translator')->trans('This is not the report of the person.'), 1);
} }
@ -418,8 +418,6 @@ class ReportController extends Controller
array('person_id' => $report->getPerson()->getId(), 'report_id' => $report_id))); array('person_id' => $report->getPerson()->getId(), 'report_id' => $report_id)));
} }
$errors = $editForm->getErrorsAsString();
$this->get('session') $this->get('session')
->getFlashBag() ->getFlashBag()
->add('danger', ->add('danger',