Answer the question
In order to leave comments, you need to log in
How in Doctrine, in DBAL to specify PDO::ATTR_PERSISTENT => true?
In tests I get an error:
[Doctrine\DBAL\Exception\ConnectionException] An exception occurred in driver: SQLSTATE[08006] [7] IMPORTANT: sorry, too many clients already
$connection = new PDO('DSN', 'user', 'password', [PDO::ATTR_PERSISTENT => true]);
Answer the question
In order to leave comments, you need to log in
The entity manager uses one Connection object, the Connection uses the PDO object, there is always one connection everywhere and it works throughout the entire life cycle of the application, this is the essence of the work (well, including) of the DI container - to give the same object and not produce them. That is, everything works for the life cycle of the application.
Tests are functional? Can many http requests in different processes breed? But if so, then all the same, the processes are different and the PDO objects are different, so your setting will not work, because the applications themselves will just be different ...
For such cases, Codeception has such a thing as persistService, in theory a service (in your case, EntityManager , if you work through it, or Connection, if you work through DBAL) one must go through this single thing, even if different http requests
https://codeception.com/docs/modules/Symfony#persi...
Krch, reveal some details of your tests and the situation, maybe I'm writing everything in the wrong place
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question