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
3 answers

Symfony 5 - Customize Twig error templates

I'm trying to customize error templates on my Symfony 5 project. I want to use the TwigBundle error renderer because it seems to be the lightest solution. So I followed this doc :…
Rémi Leblanc
  • 33
  • 1
  • 3
4
votes
1 answer

How to make Select from array in Symfony Entity

I'm new to symfony and still learning, my question is how do I populate a select drop-down in a form with an static array of choices. Say I have a class named Cake, I'd like to be able to fill a drop-down for the status of Cake from the array…
DohMoment
  • 117
  • 2
  • 8
4
votes
2 answers

Prevent user from logging in if his status is inactive

I am trying to block user from logging in his status is inactive. I am using API-Platform with LexikJWT bundle. I have tried to make a JWTAuthentication guard by extending JWTTokenAuthenticator->checkCredentials but the problem is that this works…
Erik Kubica
  • 1,180
  • 3
  • 15
  • 39
4
votes
1 answer

Symfony 4.4 deprecation warning for multiple clients in user test is deprecated, still present in documentation

Symfony version(s) affected: 4.4.0 Description After upgrading to Symfony 4.4.0 I got the following deprecation warning: Calling "Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient()" while a kernel has been booted is deprecated since…
Karis Ashton
  • 65
  • 1
  • 7
3
votes
1 answer

symfony mailer retrieve SentMessage object

I use symfonymailer the way described in Sending Emails with Mailer/Debugging emails The SentMessage object returned by the send() method of the TransportInterface provides access to the original message (getOriginalMessage()) and to some debug…
endo.anaconda
  • 2,449
  • 4
  • 29
  • 55
3
votes
1 answer

How to use Association field in Symfony EasyAdmin 4

When I use: public function configureFields(string $pageName): iterable { return [ AssociationField::new('XYZ') ]; }` I get error "Object of class App\Entity\XYZ could not be converted to string" When I add…
Tim
  • 75
  • 1
  • 7
3
votes
1 answer

Symfony5 Form multiple select (choices list) data auto-update with AJAX

I have a location form with three "select" (choices list) : country, area and department. These "select" have by default all the list of country, area and department. I want to let my user choose a country first or an area or a department. What I…
ZoeBercy
  • 33
  • 4
3
votes
0 answers

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

I updated a Symfony project from version 3.4 to 5.3, and after that, I am getting the following error on some pages: Unable to find "Proxies\__CG__\App\MyBundle\Entity\User" entity identifier associated with the UnitOfWork at…
Justas
  • 39
  • 2
3
votes
1 answer

Symfony5 / write a Custom Authenticator with API always return me Invalid credentials

I need to validate a user via external and sticky the session, but at the moment, I want to validate any user. I'm following the Custom Authenticator doc: https://symfony.com/doc/current/security/custom_authenticator.html I create a User and…
3
votes
1 answer

Symfony 5.3 empty collection with a OneToMany relation

I have on my Symfony 5 project, 2 entities : Client and Template. Each Client has one or more templates (OneToMany), each templates relates to only one Client (ManyToOne). I have a getTemplates() function in Client.php which returns a Collection of…
HectorB
  • 113
  • 6
3
votes
3 answers

Check JWT (Firebase) Token with Symfony 5.3

I'm working on an API, and I had implemented a JWT to make it stateless. I created an AuthController, which returns a JWT when login information is correct. Here you can see the return code that generates the token: /* RETURN MESSAGE */ $body = [ …
FourBars
  • 475
  • 2
  • 14
3
votes
2 answers

How to launch a Symfony Command asynchronously during a request using the Symfony Process component?

I'm trying to execute a Symfony Command using the Symfony Process component so it executes asynchronously when getting an API request. When I do so I get the error message that Code: 127(Command not found), but when I run it manually from my console…
Calamity Jane
  • 2,189
  • 5
  • 36
  • 68
3
votes
1 answer

Changing the default of number_format filter through the core extension

I want to change the default settings of number_format on twig. In their docs they show how to do this $twig = new \Twig\Environment($loader); $twig->getExtension(\Twig\Extension\CoreExtension::class)->setNumberFormat(3, '.', ','); My question is…
Wadie M
  • 33
  • 4
3
votes
2 answers

Error after upgrading to Symfony 5.3 and updading flex recipes (symfony:recipes:install --force)

Trying to perform a "minor" version upgrade (5.2 to 5.3) on a fresh/clean symfony 5.2 project (i.e. composer create-project symfony/website-skeleton:"5.2.*" s5test) Then i just add a home page for testing purposes…
pok_net
  • 358
  • 3
  • 12
3
votes
0 answers

How do I show an array of js objects in symfony form?

Symfony 5.3 + EasyAdmin 3.3.2 + Doctrine New approach of asking SO questions: short and simple (I got banned from asking questions before and I have no idea what I did wrong) What I have: I have an entity 'Device' which has a field…
Quatsch
  • 361
  • 1
  • 8
  • 29