php - Symfony2 - numeric fields in form collection trigger database update -


I have two entities, called booking and rooms . Rooms have been embedded as a collection in the booking form. Everything works fine.

Then I installed the SimpleThings / EntityAuditBundle to make changes to the version in the record. All this works well and according to the expectations, except one thing,

Say I have room defined in booking . I edit bookings , but make zero changes in the form, and save it. Strange - A record is now in the cell_document table that I have changed my values ​​from cell records to embedded form collections and so on. But I did not make any changes before saving.

Then through trial and error, I determine that if I remove the value form field from the RoomType embedded archive, which That type of type is currency , then this additional audit record is not visible if I change the field type of value to numeric Saves again on savings if I change field type to text This stops additional records show it does.

SUMMARY

It looks like numeric field type, such as a currency or an embedded form archive, to a number in the preUpdate lifecycle Callback is being compelled to turn on, even when no changes have been made, no change has been made, change the field type to text and preupdate handler is not called until the form changes A values ​​are not.

Does anyone know why this behavior seems to be based on numeric form field types?

I am using Symfony2.5.2 standard version on MySQL with PHP 5.5.9

thanks

I had a very similar problem when a form was collected in which there was a text field. If I have loaded this form for editing - but have not made any changes - it still updates the updates of all the entities in the archive.

I came to know that in my theory 2 - when defining the unit - property was declared as an integer - not a varchar when I changed the form field to an integer - form handler now Attempts to update all entities in the archive have not been attempted.

So - you should probably see your principle 2 annotation and make sure that the form field type matches your database schema.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -