DevOp - consultant - artisan

Qualité, amélioration continue, agilité, professionnalisme.

Un besoin ? Un projet ? Écrivez moi !

Symfony Ajax populated ENTITY field handle

Share Button

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

Symfony\Component\Validator\ConstraintViolation

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

Caused by:

Symfony\Component\Form\Exception\TransformationFailedException

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

Caused by:

Symfony\Component\Form\Exception\TransformationFailedException

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 http://symfony.com/doc/2.7/form/events.html#event-subscribers.

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 🙂

Share Button

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

Share Button

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 !

 

Share Button

debian, ubuntu under KVM really slow

Share Button

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"
EndSection

And reboot !

 

Share Button