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
7
votes
2 answers

Doctrine PHP 8 Attributes

I use PHP8, Symfony 5.2 and Doctrine 3.0 in my project, But the PHP 8 attributes, allowed since Doctrine 2.9, doesn't seem to work. use Doctrine\ORM\Mapping\Entity; ** * @Entity(repositoryClass="App\Repository\MyClassRepository") */ class…
Chuck Norris
  • 1,125
  • 1
  • 12
  • 28
7
votes
1 answer

How to configure apcu for doctrine in Symfony5

In Symfony4 I was using the following configuration for doctrine apcu caching: doctrine: orm: auto_mapping: true auto_generate_proxy_classes: false metadata_cache_driver: apcu query_cache_driver: apcu …
dominikweber
  • 622
  • 1
  • 9
  • 23
7
votes
3 answers

Symfony 5 Api Testing createClient() LogicalException

As the title says, I'm building an API with Symfony 5. I have some controllers that require different user permissions that I'd like to test, so I decided to create two users with different roles for testing purpose - ROLE_USER and ROLE_ADMIN. The…
Bosko Stupar
  • 143
  • 1
  • 1
  • 8
6
votes
1 answer

How to handle Symfony 5.3 deprecations?

After upgrading Symfony from 4.4 -> 5.3 i get some deprecations which I cant located to solve. Here are 3 deprecations as example: User Deprecated: Since symfony/framework-bundle 5.3: The "session.storage.factory.service" service is deprecated, use…
Daniel Richter
  • 768
  • 5
  • 23
6
votes
1 answer

Symfony 5 security.interactive_login event not called

I want to use the security.interactive_login event to update my User's last login field. The event is successfully registered: php bin/console debug:event-dispatcher security.interactive_login Registered Listeners for "security.interactive_login"…
Erdal G.
  • 2,694
  • 2
  • 27
  • 37
6
votes
2 answers

Symfony: send failed messages via email

I have a simple messanger config: framework: messenger: failure_transport: failed transports: async: dsn: '%env(MESSENGER_TRANSPORT_DSN)%' retry_strategy: …
writ3it
  • 311
  • 2
  • 12
5
votes
3 answers

How to access a private service in Symfony 5.3 phpunit tests?

I want to define a functional testcase for my phpunit-tests for my Symfony 5.3 application which requires the private service security.password_hasher from the container. I get the following…
Roman
  • 2,530
  • 2
  • 27
  • 50
5
votes
1 answer

How can I introduce filtering functionality for a virtual property in Api-Platform?

I am using Symfony 5 and the API platform. A class of mine has one of its properties set through a postLoad listener. The property is only set under certain conditions (otherwise it is NULL), and I would like to allow the REST API user to filter…
5
votes
1 answer

How to set a custom ErrorRenderer in symfony 5?

Problem: I tried to register a CustomErrorRenderer on Symfony 5 to render my CustomException, but all the time the TwigErrorRenderer is called. I thought probably self-defined renderers might be preferred? CustomErrorRenderer.php: namespace…
myself
  • 63
  • 5
5
votes
2 answers

Symfony: $images must be an instance of Doctrine\Common\Collections\ArrayCollection, Doctrine\ORM\PersistentCollection used

I currently have the following error with my entity code, and I don't really understand why I am having this problem. I only have it in the page of my create dashboard, while I don't call the images but only the heritages, and in the form everything…
AlexVWeb
  • 101
  • 1
  • 4
5
votes
2 answers

Symfony 5.1.3 Issue while clearing the cache: Attempted to load class "MappingDriverChain" from namespace

I have updated my symfony application to 5.1.3. But since then there is a class missing exception on clearing the cache. In App_KernelDevDebugContainer.php line 1050: …
Nandakumar V
  • 4,317
  • 4
  • 27
  • 47
5
votes
1 answer

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: Instead of defining routes in the controller…
Caconde
  • 4,177
  • 7
  • 35
  • 32
5
votes
0 answers

Symfony can't find secret environment variable

I am trying to set up a secret manager in Symfony 5. I followed this Secrets Management Setup course and How to Keep Sensitive Information Secret documentation. My app is now triggering : Fatal Error: Maximum execution time of 30 seconds…
Benjamin
  • 341
  • 4
  • 15
5
votes
2 answers

Symfony 5 cache:clear php.CRITICAL: Fatal error: Allowed memory size

I am encoutering the following error with Symfony 5 when trying to bin/console cache:clear I know how I could patch that (memory_limit=-1) but I want know why I have this error. Error : PHP Fatal error: Allowed memory size of 134217728 bytes…
tonyRICHER
  • 67
  • 1
  • 2
  • 7
4
votes
1 answer

How to deserialize a nested array of objects declared on the constructor via promoted properties, with Symfony Serializer?

Take the following DTO classes: class UserDTO { /** * @param AddressDTO[] $addressBook */ public function __construct( public string $name, public int $age, public ?AddressDTO $billingAddress, public…
BenMorel
  • 34,448
  • 50
  • 182
  • 322
1
2
3
71 72