W
W
WarGot2014-07-11 08:55:50
symfony
WarGot, 2014-07-11 08:55:50

Sonata FormMapper how to execute arbitrary code before saving to database?

I build the form according to its essence using the FormMapper, it saves everything to the database well, it works fine, but it is necessary to display several arbitrary fields on the form (I figured it out), and then, when submitting data from the form, before sending the information to the database, pick up the values ​​of these fields and perform manipulations.
How to do it correctly in sonata? I would be grateful either for an example, or for a good link.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoneFletcher, 2014-07-14
@WarGot

This can be done in the prePersist function in the admin class:
sonata-project.org/bundles/admin/master/doc/refere...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question