202 questions
0
votes
0
answers
53
views
How to Remove Unnecessary Slashes in Symfony Routing Generated Links
Symfony routing 5.4.48 (Without framework)
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\...
2
votes
0
answers
70
views
How to use the equivalent to "EnumRequirement", available in a routing attribute, on YAML routing configuration?
What is the equivalent of this route requirements configuration in YAML format?
#[Route('/foo/{bar}', requirements: ['bar' => new EnumRequirement(SomeEnum::class)])]
https://symfony.com/blog/new-...
1
vote
3
answers
753
views
Define two routes with same base on Symfony
I have two routes GET /users/{id} and POST /users/{id}/file.
When I try to call the second one (POST /users/{id}/file), I get an error 405 Method Not Allowed.
I use Symfony 6.4.
My routes are defined ...
0
votes
1
answer
175
views
Troubleshooting @ParamConverter Issue in Symfony
When calling a method in my controller, I encounter an issue with the @ParamConverter annotation in Symfony. The specific error I am facing is: App\Entity\Recipe object not found by the @...
0
votes
0
answers
337
views
Symfony ignores routing and shows phpinfo
I'm new to Symfony and I'm trying to make a simple web page, afterinstalling docker, php 8.3 and composer, I downloaded a Symfony image (v5.4.20) and added doctrine to it
Now, both the database and ...
3
votes
1
answer
195
views
Symfony 6: create action route with dynamic parts
I have a controller action in my project based on Symfony 6.3:
#[Route('/test')]
class TestController extends AbstractController
{
#[Route('/events/page/{page<\d+>?1}/itemsPerPage/{...
1
vote
0
answers
828
views
Symfony 6.3 Error unable to fetch the response from the backend when accessing dynamic route
I have a Symfony project in which all the routes work well except the only dynamic route service/{path}. I get the error "# unable to fetch the response from the backend: read tcp 127.0.0.1:52258-...
0
votes
0
answers
578
views
Symfony 6: how to register custom URL matcher
For some reason I need to register custom URL matcher in Symfony 6 but I'm getting weird error that my service doesn't exist:
Service "App\Routing\QueryStringUrlMatcher" not found: the ...
0
votes
2
answers
851
views
Check if URL is in use in Symfony
I need to check if entered value, e.g "specialist", is not in use as an URL in Symfony 6 application.
Simple ANY-method paths are simple:
/** @var RouterInterface $router */
$router->...
0
votes
0
answers
204
views
Symfony\Component\Routing\RouteCollection Problem
I am include an App.php (rounting) page but my front.php do not get the type RouteCollection object (Argument #1 ($routes) must be of type Symfony\Component\Routing\RouteCollection)
I am doing the ...
0
votes
0
answers
270
views
Incorrect routing via /config/routes.php in symfony 6.1
When I am defining routes in config/routes.php then those routes are not working in symfony 6.1
use App\Controller\BlogController;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;...
0
votes
0
answers
880
views
Symfony 6.1 Route Priority for Multiple Controllers
In a Symfony 6.1 project, I have created a TopicController with
#[Route('/{topic}', name: 'topic.index', methods: ['GET'])]
and then I created PhotographerController with
#[Route('/', name: '...
1
vote
1
answer
538
views
How can I change the routes for Taxons in sylius-standard?
I am trying to change the routes for my Taxons but cannot find a way to do it.
Current: {domain}/taxons/{taxon name}
Desired: {domain}/categories/{taxon name}
After searching Google/Stackoverflow I ...
0
votes
1
answer
65
views
Routing problem after upgrading from LTS 8 to LTS 9 (RealURL -> Core routing)
After migrating our site from version 8 LTS to version 9 LTS, I have some configuration problems with the routing.
With RealURL we use the fixedPostVars, 'noMatch' => 'bypass'.
For example with ...
5
votes
1
answer
1k
views
Named Routes in Symfony 6 with controllers in inner directory
I moved all my controllers to /src/Web/Controller in my Symfony 6 project like follows
├── src
│ ├── ...
│ └── Web
│ | ├── Controller
│ | ├── ....
| |── Kernel.php
my routes.yaml is ...
1
vote
1
answer
581
views
Overriding Symfony Controller Methods doesn't work properly
I am trying to create a new controller function in the overridden controller class but it doesn't work as intended.
I have a common bundle where I use it for many clients. When sometimes when a client ...
1
vote
1
answer
2k
views
Multiple subdirectories for controllers in annotations.yaml
I'm am trying to organize my controllers a bit more in a Symfony 5.3 application. They are in a couple of subdirectories and use annotations for their routing. Here are some samples:
../src/StuffA/...
0
votes
0
answers
212
views
Why my Symfony route is overridden by other routes?
I use annotations to define routes in my project. I have a controller method that has such a route:
/**
* @Route("/{slug}", name="showcompany")
*/
public function show(Company $...
0
votes
1
answer
312
views
Dynamic routing & templates in symfony
Recently while building my CMS in Symfony, I've run into a problem. I have 2 controllers, publicationcontroller and contactcontroller. In both controllers, an instance of the entity Page is loaded ...
0
votes
2
answers
3k
views
How to use PHP constant in routing YAML
I'm using Symfony 3.4
I managed to get the PHP constant to work for a service (as described in the documentation). But I can't figure out how to get it to work in a routing file. Here's what I have so ...
2
votes
0
answers
317
views
Why Symfony generates route with kernel name?
I can't realize, why Symfony generates the route
kernel:
resource: ../../src/Kernel.php
type: annotation
I read documentation
https://symfony.com/doc/current/routing.html#creating-routes-as-...
4
votes
1
answer
2k
views
Class "1\HomeController" does not exist
I'm learning from scrach Symfony the version 5.0.1.
I created a project with the --full option.
The Annotations package is already installed.
Here is my error :
Class "1\HomeController" ...
0
votes
2
answers
234
views
Symfony 4 - User becomes null on callback from external API service
On Symfony 4, when catching a callback route from any external API service (in this case - Shopify API), my logged in user becomes anon.
(HTTP): Everything works when testing on localhost
(HTTPS): ...
-1
votes
1
answer
66
views
Internationalized routing don't work fine with security access controls
I'm trying to use Internationalized routing.
So for one route many URLs.
But one route still being uniquely identified by its name.
This is a great feature but the doc don't says how to deal with the ...
1
vote
1
answer
173
views
route defined with negative lookaround matches the route despite the negative assertion
We want to open a DELETE endpoint that allows calls to all positive integers, but not id 1 (aka element 1 cannot be deleted)
Usually to open an endpoint that allows positive integers I configure the ...
0
votes
1
answer
1k
views
Symfony5 throws 404 in browser, but route is found in cli
Iam using react+symfony with webpack. Everything works with simple url eg. one slash in url ("/aboutus","/moodle") but when i try access route with multiple slashes("/admin/...
0
votes
0
answers
53
views
How handle router with container's services/parameters dynamically?
I've used the Symfony route bundle and DI bundle in my non Symfony project.
I inject dependencies to the controllers/actions by the code below:
// Find the current route
$parameters = $router-&...
-1
votes
1
answer
3k
views
How to provide Symfony routing parameter programatically?
In this Symfony route
/**
* @Route("/board/{board}/card/{card}", name="card_show", methods={"GET"}, options={})
*/
public function show(Board $board, Card $card): ...
-1
votes
1
answer
845
views
Route not found/matched when using symfony 4 inside a subfolder
I have this apache server configured in mydomain.com/applications and inside that folder I have
/project1/ - using silex
/project2/ - using symfony 4
The server uses mod_rewrite and mydomain.com is ...
1
vote
0
answers
622
views
Subresources routes in symfony 5 with API-platform
I am trying to declare a subresource in my symfony app. I followed the api-platform doc about it: https://api-platform.com/docs/core/subresources/
The subresource does appear in the routes, but not ...
3
votes
1
answer
986
views
Symfony routing, separate route setup and ignore _locale prefix?
I have in my annotations.yaml following setup to use annotation route setup:
controllers:
resource: '../../src/Controller/'
type: annotation
prefix:
en: ''
sr: '/es'
...
8
votes
1
answer
4k
views
PageController can't be requested via XmlHttpRequest in Shopware 6
I am trying to send a request to my custom StorefrontController on the latest Shopware 6.2.2 but I am getting the following error:
PageController can't be requested via XmlHttpRequest.
I am doing a ...
5
votes
1
answer
4k
views
Why doesn't Symfony 5.1 recognize routes configured on a "routes.php" file?
I'm having a hard time trying to configure my routes using a config/routes.php file in Symfony 5.1.
As per the Symfony routing documentation, I should be able to configure my routes in a PHP file:
...
0
votes
1
answer
353
views
TYPO3 9 Routing - the parameter gets overwritten by the defaults
I'm trying to create a URL-structure like /maincategory/subcategory/ and this works, it looks good but with my code it loses the parameter "mwWsCategory2" and replaces it with the value under "...
0
votes
0
answers
230
views
Symfony 2.8 how to get Route option
With EventListener I use my lass TransactionListener. This class check permission for current url. Some URL are open. I check it by attribut "option" in routing.yml
For getting option on current ...
2
votes
1
answer
856
views
How to use different controllers, depending on the user role, for the same route?
I'm trying to implement multiple controllers which listens to one route /account.
There are two controllers and only one should be executed on that URL where the choice lies within user's role.
...
4
votes
2
answers
986
views
Routing exception after upgrading to TYPO3 v9.5.14
After upgrading to TYPO3 v9.5.14 our detail pages for news crash with the exception
Symfony\Component\Routing\Exception\InvalidParameterException
Parameter "p88bd715a41119d0e8087a5d19cb049" for ...
0
votes
1
answer
1k
views
Symfony onKernelRequest headers->set dont received on @Route
I have functionm onKernelRequest when i want to add some custom header(in my case api=true||$request->headers->set('api', "true")) and in all Request $request i can get that header but when i ...
0
votes
0
answers
1k
views
Validate optional input GET parameters passed in through the querystring as integers in Symfony 3.4
In Symfony 3.4, is there a way to validate optional input GET parameters passed in through the querystring as integers?
If provided, I am using the $ownerId and $courseId to query the corresponding ...
0
votes
1
answer
474
views
How to add prefix to some controllers using annotations?
I have at the moment two controllers.
GitlabAuthController
UserController
I need to add the path prefix api to UserController only.
Before I was trying following at annotations.yaml file:
...
2
votes
2
answers
936
views
Symfony Always Include Route Default Values
So basically I am trying to achieve this: New in Symfony 4.3: Always Include Route Default Values
I have a task entity, which has multiple states like new, open & closed.
For this reason I am ...
1
vote
1
answer
209
views
TYPO3 9 routing - .html
Is there a possibility to configure routing in TYPO3 v9 to have .html applied to every URL? In ext:realurl and TYPO3 v8 (and previous versions) configuration defaultToHTMLsuffixOnPrev could have been ...
-1
votes
2
answers
5k
views
How to generate an URL for a controller in Symfony?
I know how to generate an URL for a route. However now I need to generate an URL for a controller or for a controller with a method. I checked the sourced of UrlGenerator but did not find any relevant ...
1
vote
1
answer
923
views
Optional trainling slash for optional slugs in POST route
I am using Symfony 4.2. When I set a route with an optional parameter, can I still use the route without a trailing slash?
api_post:
path: /api/drive/{slug?}
controller: App\Controller\Api::...
1
vote
0
answers
387
views
TYPO3, routeEnhancers, rewrite simple url with parameters
In TYPO3 Version 9.5.11 I would like to have my own URL rewritten with GET parameters. The URL looks like this:
https://www.website.com/my-page/?logintype=login&dc=1246dh4bd6&code=...
0
votes
1
answer
462
views
Route Not Found In Prefix Root Path
I'm trying to setting up symfony/routing component on my project..
Things go well but when I define prefix for routes, it throw route not found exception for root path of this prefix.
For example, ...
3
votes
1
answer
1k
views
Migrating legacy project to Symfony routing issues
I'm trying to start migrating my legacy project to Symfony, piece by piece (Strangler Application). I followed this documentation, but I can only load my home URL / of my legacy application. Other URL'...
1
vote
1
answer
214
views
Is there a way to use both dynamic and static path on one controller?
I'm creating a Symfony CMS by myself. I want to map paths like /login and /{slug} at the same time, but I don't know if it is possible.
I tried simply setting both of the paths in 2 different ...
4
votes
1
answer
1k
views
Routing issue - every route matched with urlRedirectAction
I'm in the process of upgrading Symfony from 3.4 to 4.3 and I have a situation in which every route is matched with controller and method correctly, but then the request reaches ...
1
vote
1
answer
2k
views
How to return specific data using urls and routing in symfony 4 when making an API GET request?
I'm new to Symfony and trying to learn the basics. I recently saw this question and I wanted to learn how routing works. So I copied the Controller1.php from the question and changed it to ...