symfony

Symfony 5 - PhpUnit - Database not refresh on running test

一个人想着一个人 提交于 2021-02-10 07:01:21
问题 I noticed that when I run a functional test with PhpUnit, if there is a modification in the database, it is done. However, if I'm in the middle of my test and want to recover the record that was changed, it comes back to me in its old version, which is very problematic. For example, if I have a test in which: I collect a certain item I activate it (therefore, modification in the database of its enable property) via a URL of a controller I want to check that it is active I retrieve it from the

Doctrine2 DBAL Exists query

删除回忆录丶 提交于 2021-02-10 06:34:22
问题 I would like to ask for your help with Doctrine2 DBAL query built with QueryBuilder . I'm used to ORM, but I think it's an overkill for such query which is being called in a listener. I need a query with SELECT EXISTS and I don't know how I can construct it using DBAL QueryBuilder . I have a subquery already created: $subQuery = $connection->createQueryBuilder(); $subQuery ->select('o.id') ->from('order', 'o') ->leftJoin('o', 'payment', 'p') ->where($subQuery->expr()->isNull('p.id')) ; I

Symfony: Base table or view already exists: 1050 Table 'migration_versions' already exists

寵の児 提交于 2021-02-10 05:15:31
问题 I've done something horribly wrong to my migration_versions, deleted the versions from the migrations folder now and I get this error when try to run anything to do with migrations. Could someone point me in the direction of where to start to fix this? If I drop the database and then make:migration , the migration_versions table appears in the db. After that if I try to run php bin/console doctrine:migrations:migrate I get the error: In AbstractMySQLDriver.php line 38: An exception occurred

Symfony: Base table or view already exists: 1050 Table 'migration_versions' already exists

人盡茶涼 提交于 2021-02-10 05:15:27
问题 I've done something horribly wrong to my migration_versions, deleted the versions from the migrations folder now and I get this error when try to run anything to do with migrations. Could someone point me in the direction of where to start to fix this? If I drop the database and then make:migration , the migration_versions table appears in the db. After that if I try to run php bin/console doctrine:migrations:migrate I get the error: In AbstractMySQLDriver.php line 38: An exception occurred

Attach excel stream to swiftmailer message?

…衆ロ難τιáo~ 提交于 2021-02-09 18:06:26
问题 I'm trying to attach an Excel file in a SwiftMailer message. The trick is that I don't want to save the excel file and then attach it and then delete it, instead I just want to generate the excel and attach that to the message. This function allows to attach a OutputByteStream /** * Create a new Attachment. * * @param string|Swift_OutputByteStream $data * @param string $filename * @param string $contentType * * @return Swift_Mime_Attachment */ public static function newInstance($data = null,

Attach excel stream to swiftmailer message?

≯℡__Kan透↙ 提交于 2021-02-09 17:53:51
问题 I'm trying to attach an Excel file in a SwiftMailer message. The trick is that I don't want to save the excel file and then attach it and then delete it, instead I just want to generate the excel and attach that to the message. This function allows to attach a OutputByteStream /** * Create a new Attachment. * * @param string|Swift_OutputByteStream $data * @param string $filename * @param string $contentType * * @return Swift_Mime_Attachment */ public static function newInstance($data = null,

Attach excel stream to swiftmailer message?

倖福魔咒の 提交于 2021-02-09 17:48:34
问题 I'm trying to attach an Excel file in a SwiftMailer message. The trick is that I don't want to save the excel file and then attach it and then delete it, instead I just want to generate the excel and attach that to the message. This function allows to attach a OutputByteStream /** * Create a new Attachment. * * @param string|Swift_OutputByteStream $data * @param string $filename * @param string $contentType * * @return Swift_Mime_Attachment */ public static function newInstance($data = null,

Attach excel stream to swiftmailer message?

巧了我就是萌 提交于 2021-02-09 17:46:38
问题 I'm trying to attach an Excel file in a SwiftMailer message. The trick is that I don't want to save the excel file and then attach it and then delete it, instead I just want to generate the excel and attach that to the message. This function allows to attach a OutputByteStream /** * Create a new Attachment. * * @param string|Swift_OutputByteStream $data * @param string $filename * @param string $contentType * * @return Swift_Mime_Attachment */ public static function newInstance($data = null,

OpCache with Symfony

ε祈祈猫儿з 提交于 2021-02-08 17:14:58
问题 I know you can use with Symfony APC or XCache Class Loader. Unfortunately, in the shared server where I put my Symfony code, there is only OpCache with is activated. Can I use Symfony with OpCache ? If yes, how and what is the code to put in my app.php please ? If not, why please ? 回答1: You don't have to do anything in Symfony to enable opcache. You only need to make sure it's enabled in your PHP configuration ( opcache_enable option). Forget APC/XCache class loaders. APC/XCache class loaders

Request on key/value in a JSON type field with Doctrine2

耗尽温柔 提交于 2021-02-08 13:18:18
问题 I'm trying to figure out how, in a symfony 3.4 app, to retrieve (through a repository method, with a DQL request for example) entities depending on a value for a specific key in a "json" typed column. Saw there's some stuff possible with postgre but I didnt find anything with mariaDB Let's say I get an entity Letter with this property : /** * * @ORM\Column(type="json") */ private $metadatas; which contains, for example: { "key1": "value", "key2": "value" } How can I, or, Is it possible to