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
2
votes
1 answer

symfony 4 to 5 cache error when/after upgrade

My problem : Cache Error when upgrading symfony 4.4 to 5.0 (cache clear work on 4.4 ) php : 7.2.5 when upgrade, 7.1 before upgrade Before update symfony 4.4 to 5, i've followed this doc (symfony doc 4.4 to…
2
votes
2 answers

Unable to find "Proxies\__CG__\App\Entity\EnseigneNationale" entity identifier associated with the UnitOfWork

Client.php /** * @ORM\ManyToOne(targetEntity="EnseigneNationale", inversedBy="clients") * ... */ private ?EnseigneNationale $enseigneNationale; /** * @ORM\OneToMany(targetEntity="ClientBanque", mappedBy="client", cascade={"persist", "remove"}) …
Ahmed Kallali
  • 79
  • 1
  • 5
2
votes
0 answers

Symfony Doctrine Mapping - Different entity and property names in database

I have issue with updating entities with console command bin/console doctrine:mapping:import. Project requirements forces different names for class names and properties in code and in database, for example: /** * * @ORM\Table(name="user_db") …
2
votes
0 answers

How to use dependency injection in validator constraints with Doctrine & Symfony

I'm working on an platform which contains lot of page with form and i'm looking for a way to inject (DI) service in my Entity/Constraint Validator. I tried many way, but never managed to do 100% what i wanted it. Let me explain en detail : my stack…
Rady
  • 51
  • 3
2
votes
1 answer

How to properly calculate ETA in ProgressBar when (re)starting at a given position?

I'm using a ProgressBar for my console command, and allow the command to restart at some point in the middle of the processing: $itemCount = 1_000_000; $startItem = 150_000; $progressBar = new ProgressBar($output,…
BenMorel
  • 34,448
  • 50
  • 182
  • 322
2
votes
1 answer

Symfony Mailer Twig Context in Subject Line

I am using Symfony 5 and the mailer component with twig templating. The context works fine for the body of the email, but is there not a way to apply that to the email subject line also? Right now I'm having to manually do my own string replace,…
Rob Irvin
  • 111
  • 2
  • 9
2
votes
1 answer

Doctrine SQLFilter with QueryBuilder in Symfony not working

I'm trying to create an SQLFilter for a query in my Symfony app. The issue is that the filter is not applied on the query (and not called), even though is it enabled correctly (see below). The repository is not linked to an entity, because the…
skirato
  • 763
  • 6
  • 26
2
votes
1 answer

How to access Session in PHPUnit WebTestCase (Symfony 5)

I'm trying to test methods which requires Sessions in my PHPUnit WebTestCase, with no success. PHP 8.0, Symfony 5.4 Here's my code: When user log-in, I'm saving custom info in session: public function methodCalledAfterLoginSuccess(int…
2
votes
1 answer

Symfony unit testing with loginUser(), login not working (returning 302 to login page)

I'm building a test for a Symfony 5.4 application. I have created a test like this: public function testCreateProduct() { $client = static::createClient(); /** @var User $mainAdmin */ $mainAdmin =…
Sofia Grillo
  • 405
  • 2
  • 13
2
votes
0 answers

Lexik jwt bundle - login by username or email

I use lexik/LexikJWTAuthenticationBundle 2.14 for login in a symfony 5.4 API project I can login by username, or by email via config, but i can't have login by (username or email) Even using X-debug, I couldn't find what to custom to do that Does…
danybond
  • 21
  • 1
2
votes
1 answer

After Update from SF4.4 to 5.4, generateUrl error : "Some mandatory parameters are missing" for route with optional parameters

Since I updated Symfony 4.4 to symfony 5.4, i have a last problem to resolve. Methode "generateURl()" in controller, and "path()" in twig template return an exception for route with optional param that i dont specify for generateURl method in…
Romain
  • 41
  • 6
2
votes
0 answers

I've Segmentation fault error when I run phpunit test

I've a web project on Symfony 5.4 / PHP 8.1 I try wrote tests for my API (Api Platform 2.6.8) but. when I want to execute a request of type POST or PUT declared as in the testCreate() method in RaceApiTest, it will execute correctly without…
Kallard
  • 57
  • 7
2
votes
1 answer

Doctrine - Set $id as UUID instead of Integer when creating new entity

I am working on a new project in Symfony 5.3. I am using this command bin/console make:entity for creating entities. This wizard automatically creates an entity with $id as primary key of type integer. I am prefering UUID instead of integer. How I…
2
votes
2 answers

Symfony 5 Heroku Unable to create a signed JWT from the given configuration

So, I have deployed a JWT project in Heroku and I get following error Uncaught PHP Exception Lexik\Bundle\JWTAuthenticationBundle\Exception\JWTEncodeFailureException: "Unable to create a signed JWT from the given configuration." at…
Demi St
  • 57
  • 1
  • 5
2
votes
1 answer

Failed to store cell in cache

I am using multiple csv files to populate the tables in a database. As I am on Symfony, I created a command which from a given directory read files in a defined order. A csv file equals a table in my BD. File sizes differ from file to file and may…
Ahmed Kallali
  • 79
  • 1
  • 5