简体   繁体   中英

How add verifications before update dados of an item using framework symfony?

I need to check information when updating an item, to know if saving is allowed or not. This must be done in the backend after the user have clicked on 'UPDATE' button. I'm using Symfony and the existing methods in CRUDController. Is there any method I can add in Controller or Entity so I can add code that does this check before saving?

You have multiple ways to set validation with Symfony.

If I understand well your question, you maybe need to look at the callbacks

https://symfony.com/doc/current/reference/constraints/Callback.html

The purpose is to create custom validation with dedicated functions (like only saving an item if it meets some requirement.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM