Questions tagged [symfony-routing]

Routing in Symfony Framework's MVC implementation. Symfony is a free, open source PHP web application framework, and it is released under the MIT license.

symfony-routing is a tag suitable for any questions regarding routing in Symfony's MVC implementation, url handling, or any other matter affecting or affected by routing in Symfony.

196 questions
2
votes
1 answer

Access Denied for view and download routes in SonataMediaBundle and Symfony 4

I use Symfony 4 (more precise 4.1) with SonataAdminBundle and SonataMediaBundle. This is my config/routes/sonata_media.yaml: sonata_media_gallery: resource: '@SonataMediaBundle/Resources/config/routing/gallery.xml' prefix:…
cezar
  • 11,616
  • 6
  • 48
  • 84
2
votes
1 answer

Get the route name in a Symfony service

Im try to get the name of the current route in a Symfony 4 service. routes.yaml test-route: path: /test controller: App\Controller\Test::test service class Myservice { private $u; public function __construct(Utilities $u){ …
yevg
  • 1,846
  • 9
  • 34
  • 70
2
votes
2 answers

Symfony 3 Routing allowing hyphes/dashes in placeholder value

I am having an issue with a route in Symfony, I have a route setup that needs to match the below: /my-test-route-holidays/ The above "my-test-route" is the placeholder variable. The route in symfony is as follows: overview: path:…
Ben Osborne
  • 218
  • 4
  • 15
2
votes
1 answer

Routing is not work in Symfony 3.2

I use example from docs. This is routing.yml: app: resource: '@AppBundle/Controller/' type: annotation blog_list: path: /blog/{page} defaults: { _controller: AppBundle:Blog:list , page: 1} requirements: …
Mcile
  • 128
  • 6
2
votes
2 answers

Symfony2 acceptance test not working

At the moment, I am writing acceptance test cases for Symfony2 application. I am doing following. namespace my\Bundle\ProjectBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DefaultControllerTest extends…
bharatesh
  • 952
  • 2
  • 11
  • 23
2
votes
1 answer

Symfony 3.0 - Cannot load resource "." - Custom Route Loader

I am working on upgrading one of my projects to SF 3: The project uses some custom routing loaders which where working without problems before, now I am getting a FileLoaderLoadException stating that the resource "." couldn't be loaded. I took a…
Nickolaus
  • 4,785
  • 4
  • 38
  • 60
2
votes
0 answers

webcal:// instead of http:// in Symfony2

I've read here on how to modify a generated url in twig. What I'm missing is the routing side: I probably need symfony to be able to route: webcal://www.mywebsite.com/calendar instead of http://www.mywebsite.com/calendar to be able to share my…
Sergio Negri
  • 2,023
  • 2
  • 16
  • 38
2
votes
2 answers

Map the router placeholder with the URI values

I don't how to explain this so please be easy on me. The router holds the uri variable key $router = 'movie/english/{slug}/edit/(id}/{title}'; The URI in the browser address bar $uri = 'movie/english/scorpion/edit/125/E01E05'; How can I write the…
Red Virus
  • 1,633
  • 3
  • 25
  • 34
2
votes
0 answers

ResourceNotFoundException in Symfony when route has a query string

Odd issue So in my administration bundle, I have routes like this: /** * @Route("/media") * * Class MediaController * @package AdminBundle\Controller */ class MediaController extends Controller { /** * @Route("", name="media_home") …
RedactedProfile
  • 2,748
  • 6
  • 32
  • 51
2
votes
3 answers

Symfony, dynamic routing

I have a symfony project with multiple skins/templates that have their own routes, does anyone have an idea for a correct setup? Every skin/template is its own bundle, since its not just skins and assets, but maybe also services that might exist in…
Alt-rock ninja
  • 165
  • 1
  • 13
2
votes
2 answers

Symfony2 defining routes as annotations in controller

I need an expert suggestion. What is ideal in terms of performance and standards? 1) Defining all routes in src//Resources/config/routing.yml as suggested by Symfony base tutorial ? OR 2) Defining routes in controllers as annotations? Both seems…
user3227262
  • 563
  • 1
  • 6
  • 16
2
votes
1 answer

Migrating routes from old format to new one, where is the docs for this? Missing?

As perhaps you may notice from my previous recently post I'm working on SF2.0.x app to new SF2.7. Right now I'm having a lot of NOTICE and they don't affect app functionality but it will do and I want to prevent this. I have read Routing chapter at…
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
2
votes
1 answer

Restrict routes to a Ajax call, it's possible in Symfony 2.6+?

I'm looking the best way to achieve "automatic" routing restriction to Ajax calls. Right now I'm doing as follow: /** * @Secure(roles="IS_AUTHENTICATED_FULLY") * @Route("/someRoute", name="someRoute") * @Method("POST") */ public function…
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
2
votes
1 answer

Routing static urls in javascript files in symfony

I have some javascript files in my Symfonyt2 project that load some reources dynamically from the javascript file. for example: $('.records_list').DataTable({ "language": { "url": "../shared/js/datatables.persian.json" } }); the…
Ariyan
  • 14,760
  • 31
  • 112
  • 175
2
votes
3 answers

whats the point of using the @Method annotation

Route Method¶ There is a shortcut @Method annotation to specify the HTTP method allowed for the route. To use it, import the Method annotation namespace: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use…
user3531149
  • 1,519
  • 3
  • 30
  • 48