Artisan Développeur

Qualité, amélioration continue, agilité.

Symfony Ajax populated ENTITY field handle

If you use an ENTITY type field in your formType, and if you populated this field with Ajax, you can have this error :


Object(Symfony\Component\Form\Form).children[tag] = 2

Caused by:


Unable to reverse value for property path "tag": The choice "2" does not exist or is not unique

Caused by:


The choice « 2 » does not exist or is not unique

I have a user Entity with a ManyToOne relation with a Tag entity.

In my form, when I select the user, an AJAX request retrieve all the user’s tag, and add the options on the select element.

But Symfony doesn’t know about these values, and the validation fails when the form is submitted.

After lot of tests, with data transformer, listener, both, I succeed with a simple event subscriber following this symfony doc page

Basically, the event subscriber occurs on the pre_submit, take the ID of the TAG, and add an entity field with a custom query who retrieved the good tag entity.

Enough talk, more code 🙂

Permission denied creating inbox file in /var/mail – dovecot

Hi !

this morning I have seen this error :

Permission denied creating inbox file in /var/mail

I have done a basic setup of dovecot + postfix.
At the time to test my new mailbox, after added a new user, no luck, and this message in the log.

Solution is really simple, as the mailboxes are owned by the user, and the group is set to « mail »

-rw-------  1 amavis    mail    836 Jun 19  2015 amavis
-rw-------  1 jenkins   mail 442270 Sep 30 00:00 jenkins
-rw-------  1 root      mail 634190 Sep 30 00:12 root
-rw-------  1 technique mail      0 Sep 30 14:43 technique

You just need to add your user to the « mail » group :

addgroup technique mail

Where « technique » is my username.

That’s all !


debian, ubuntu under KVM really slow

I can’t remember where I found this, so, if you are the original author of this solution, say hello, with the original link 🙂

If you install a debian or an ubuntu, you can experience some bad perf.

I use virt-manager to manage my vm’s.

Simple file with some options for the QXL driver fix the problem.

nano /usr/share/X11/xorg.conf.d/qxl.conf

Inside the file :

Section "Device"
    Identifier "qxl"
    Driver "qxl"
    Option "ENABLE_SURFACES" "False"

And reboot !