skip to Main Content

Php – Multiple url definition with conditions within the same controller for symfony's routing system

Is there a way that I can generate multiple URLs within the same controller that use the same structure? #[Route('/project/posts/{id}', name:"project-post-view")] //old url #[Route('/project/posts/{post_ulid}', name:"project-post-view")] #[Route('/project/posts/{slug}', name:"project-post-view")] // alternative url function projectViewPost(int $id, string $post_ulid, string $slug, ManagerRegistry $doctrine) {…

VIEW QUESTION

Php – Unable to use a custom ValueResolver

I'm developing a Symfony 7 REST API. I'm following the official docs to implement a custom argument resolver to handle mapping of the request payload format that my endpoints are receiving to DTOs (https://symfony.com/doc/current/controller/value_resolver.html#adding-a-custom-value-resolver). Here's an example of a request…

VIEW QUESTION

Php – Symfony upgrade (4.4 -> 5.4) JsonManifestVersionStrategy issue

By upgrading Symfony from 4.4 to 5.4 I've taken an error Argument 2 passed to SymfonyComponentAssetVersionStrategyJsonManifestVersionStrategy::__construct() must be an instance of SymfonyContractsHttpClientHttpClientInterface or null, instance of GuzzleHttpClient given, called in /var/www/var/cache/dev/ContainerHhXYcwE/App_KernelDevDebugContainer.php JsonManifestVersionStrategy is not used in the project directly. Would…

VIEW QUESTION

Php – Symfony multiple IsGranted on a same controller not working

I have a controller on which I have 2 routes created: #[Route('/announcement/create', name: 'app_admin_restock_announcement_create'), IsGranted(RestockVoter::CREATE_RESTOCK)] #[Route('/announcement/edit/{id}', name: 'app_admin_restock_announcement_edit'), IsGranted(RestockVoter::EDIT_RESTOCK, 'restockQueue')] public function detail( ?RestockQueue $restockQueue, ... The problem is user who can create can not edit. When I debug on…

VIEW QUESTION
Back To Top
Search