In your controllers you'll often load entities with IDs coming from the URL. What's the recommended way to deal with the case that an entity was not found?
In Symfony 1.4 it was $id = $request->getParameter('id); $this->forward404Unless($user = Doctrine_Core::getTable('User')- >find($id), sprintf('User not found (%s).', $id)); For the time being I do the following in SF2: $em = $this->getEntityManager(); $user = $em->find('MyBundle:User', $id); if(!$user) { throw new Symfony\Component\HttpKernel\Exception \NotFoundHttpException(sprintf('User not found (%s).', $id)); } Are there better/recommended ways? -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en