Category: routing

Symfony 4 – Webpack-encore use FosJsRouting : Routing is not defined

I try to use FosJsRouting with Webpack-encore in my Symfony 4 project. I did : 1. composer require friendsofsymfony/jsrouting-bundle 2. php bin/console assets:install –symlink public 3. php bin/console fos:js-routing:dump –format=json –target=public/js/fos_js_routes.json And in my app.js : // FosJsRouting const routes…

Validating URL params when using the FrameworkExtraBundle to get an entity in Symfony 3.4 application

Is there a way I can validate the URL params being passed in to my route? If I try and hit this route with /resume-session/crmpicco1872/kdsjfslk/rfc/three for example Symfony throws a HTTP 500 because i’m giving it an owner id of…

404 not found , Symfony routing path problem

i create a controller pageController.php : <?php namespace AppController; use SymfonyComponentHttpFoundationResponse; class pageController { public function index() { return new Response(‘<html><body>hello…</body></html>’); } public function contactAction() { return new Response(‘<html><body>contact…</body></html>’); } } and here is the routes.yml index: path: / controller:…

Multi optional parameters in route symfony

I have route like this: * @Route( * “/search/{ro}/{mind}/{his}”, * name=”search”, * requirements={“ro”=”[a-zA-Z]{2,}”, “mind”=”()|new|old”, “his”=”()|yes|ok|no”} * ) if I want this url: /search/yes I need to enter this address: /search///yes to show page. how can remove // from original url?…