Questions tagged [symfony5]

Use this tag for questions addressing particular features of the PHP framework Symfony in version 5. Otherwise use only the general [symfony] tag plus the language tag [php].

Symfony is a framework for web and CLI-applications built on top of a catalog of Symfony components. It is free software released under the MIT license. The project's homepage is symfony.com.

Symfony 5 was released in November 2019 and includes several changes compared to its predecessor. However there are no new features compared to version 4.4.

1079 questions
4
votes
1 answer

How to stop Symfony redirecting after logout

The default Symfony behavior is to redirect to '/' after logout. I don't require any redirects from Symfony as it's an api app. Like how during login when Symfony takes control to do authentication, but then still runs the login controller to…
Bradmage
  • 1,233
  • 1
  • 15
  • 41
4
votes
1 answer

Symfony: Redirect output of a Process

I am upgrading an old Symfony application (v2.8) to Symfony 5.3. I am using the process component where the arguments have to be passed in another way than before. My previous code was like use Symfony\Component\Process\Process; $cmd =…
stollr
  • 6,534
  • 4
  • 43
  • 59
4
votes
1 answer

Symfony 5 PHP8 Attributes for Security

I have a page that I am trying to convert from annotations to PHP8 attributes. namespace App\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use…
Patrick Kenekayoro
  • 326
  • 1
  • 3
  • 10
4
votes
0 answers

How to use the LDAP form login and Form Login on Symfony 5.3 with the new Authenticator-based Security system?

I get an strange behavior when I enable the new authentication based security. I find that chain of form_login and form_login_ldap won't work together. Both on their own work, either json_login and json_login_ldap. Here is my…
4
votes
1 answer

join(): Argument #2 ($array) must be of type ?array, string given

So I am a beginner working on a project with symfony 5.2 project with php 8, and I have been trying to run this command symfony console doctrine:fixtures:load And this is the error I get : In Lorem.php line 95: join(): Argument #2 ($array) must be…
Abdel Outaleb
  • 61
  • 1
  • 2
4
votes
0 answers

Symfony 5: How can I prevent an Event Subscriber to fire twice with the Profiler (Web Debug Toolbar) active?

I created a subscriber which executes another class->method, which creates a database entry. I can see that the subscriber fires twice, because the database entries are always entered double. I deactivated the Profiler (the Web Debug Toolbar) and…
Charles
  • 179
  • 1
  • 15
4
votes
1 answer

make:entity command: [ERROR] Only annotation mapping is supported by make:entity

When I am trying to create a new doctrine entity in Symfony 5.2 (maker-bundle v1.30.0) I get: $ php bin/console make:entity Class name of the entity to create or update (e.g. GrumpyChef): > test created: src/Entity/Test.php created:…
kralg
  • 95
  • 7
4
votes
1 answer

Circular reference detected for service "session", path: "session -> session.flash_bag -> session"

I have read about Namespaced Attributes. I try to use this feature : #src/Controller/CartController.php public function addProduct(int $cart_id, int $product_id, Request $request, SessionManager $sessionManager) { $session = new Session(new…
vincent PHILIPPE
  • 975
  • 11
  • 26
4
votes
1 answer

EasyAdmin 3 Object of class DateTime could not be converted to string

I'm having a problem with easy admin 3. I followed the instructions of the symfony doc but I end up with this error: Object of class DateTime could not be converted to string when rendering the admin. Thank you for you help ! class…
4
votes
1 answer

Bundling Symfony 5 assets (managing reusable bundle assets)

I am building my own Bundle for Symfony 5 following this documentation: https://symfony.com/doc/current/bundles/best_practices.html There it says: A bundle should also not embed third-party libraries written in JavaScript, CSS or any other…
4
votes
1 answer

Symfony 5 Functional Tests - Environment Variables missing, getenv() returns false

I was rewriting one of my projects into Symfony 5. I've noticed something strange about env variables. I can't get them anymore the way I used to be able to get them in the functional tests. Not that it matters but I have my custom ApiTestCase which…
4
votes
1 answer

Doctrine\Common\Persistence\Mapping\Driver is missing

Apologies but something weird has happened to me today with Symfony. I am developing a webapp with a friend and decided to run a composer update this morning. Everything was working correctly before, but once composer update finished I got a…
user2968874
  • 101
  • 1
  • 7
4
votes
1 answer

Symfony 5.1: LDAP Authentication with Entity User Provider

I'm using Symfony 5.1 and trying to implement a LDAP Authentication, while the User Properties (Username, Roles, etc.) are stored in a MySQL DB. Thus I added a User Entity for Doctrine and configurated the services.yml and security.yml corresponding…
smogm
  • 53
  • 1
  • 8
4
votes
1 answer

Symfony 5 Can't Inject EntityManagerInterface Into Validator

I've just moved to symfony 5 and baffled! I've done this same thing with validators many times with Symfony 4, but now dependency injection of EntityManagerInterface into a custom validator produces this error: Too few arguments to function …
Glen Elkins
  • 867
  • 9
  • 30
4
votes
3 answers

How to format all HttpExceptions as json in symfony5?

Within a symfony5 controller, I can return json responses via: return $this->json(['key' => 'content'); Yet when I throw an HttpException, I see the default html error page in both dev and production. I want to create a restful api, so I want to…
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
1 2
3
71 72