with try - catch work, I wonder why the documentation does not explicitly specify a working code ))
On Sep 28, 6:51 pm, Bulat Shakirzyanov <[email protected]> wrote: > use something like > try { > $product = // retrieve the object from database > catch (\Doctrine\ORM\NoResultException $e) { > throw new NotFoundHttpException('The product does not exist.'); > > } > > for ODM you would just catch Doctrine\ODM\MongoDB\MongoDBException > the logic should be clear, let me know if further explanation is necessary. > > > > On Tue, Sep 28, 2010 at 11:18 AM, pilot <[email protected]> wrote: > > From symfony-reload.com doc: > > > 1 public function indexAction() > > 2 { > > 3 $product = // retrieve the object from database > > 4 if (!$product) { > > 5 throw new NotFoundHttpException('The product does not > > exist.'); > > 6 } > > 7 > > 8 return $this->render(...); > > 9 } > > > The 3 line generate 500 Internal Server Error - Doctrine\ORM > > \NoResultException before than go to line 4 with exception > > NotFoundHttpException > > > Doctrine produce itself exception, how to redirect doctrine exception > > to symfony2 built-in NotFound exception? > > > -- > > 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 developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<symfony-devs%2bunsubscr...@google > > groups.com> > > For more options, visit this group at > >http://groups.google.com/group/symfony-devs?hl=en -- 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 developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
