template page for list events participation by person

This commit is contained in:
2019-01-16 16:24:09 +01:00
parent d89e440784
commit 735425f2fd
2 changed files with 48 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
namespace Chill\EventBundle\Controller;
use Chill\EventBundle\Entity\Participation;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Chill\PersonBundle\Form\Type\PickPersonType;
@@ -231,5 +232,24 @@ class EventController extends Controller
*/
public function listByPersonAction($person_id)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
if ($person === NULL) {
throw $this->createNotFoundException('Person not found');
}
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
$participations = $em->getRepository('ChillEventBundle:Participation')
->findBy(
array('person' => $person)
);
return $this->render('ChillEventBundle:Event:listByPerson.html.twig', array(
'participations' => $participations,
'person' => $person
));
}
}