How can i simulate a 404 error with Symfony2? [duplicate]

You can find the solution in the Symfony2 documentation: http://symfony.com/doc/2.0/book/controller.html Managing Errors and 404 Pages public function indexAction() { // retrieve the object from database $product = …; if (!$product) { throw $this->createNotFoundException(‘The product does not exist’); } return $this->render(…); } There is a short information in the documentation: “The createNotFoundException() method creates a special … Read more

How do I force doctrine to reload the data from the database?

Have you flushed your changes to the $audit object? $audit = $dm->getRepository(“WGenSimschoolsBundle:Audit”)->findOneById(“xxxx”); //do something somewhere to change the object $dm->flush(); Every time you do a findBy(…) or findOneBy(…) it actually fetches a new document from the DB. (you should see the query in the Symfony profiler) With a find() instead, it will fetch the document … Read more

How to get list of all routes of a controller in Symfony2?

What you can do is use the cmd with (up to SF2.6) php app/console router:debug With SF 2.7 the command is php app/console debug:router With SF 3.0 the command is php bin/console debug:router which shows you all routes. If you define a prefix per controller (which I recommend) you could for example use php app/console … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)