简体   繁体   中英

Do action right after entity created in SonataAdmin

is there any way that I could config my SonataAdmin to do action right after the default CRUD?

The situation is that, I've got some classes, each class has a BCode, which must be created with the entity. BCode is a tweaked crc32 string. so I need a customized action to be able to create this code with entity.id

thanks in advance

Your admin class extends the vendor/sonata-project/admin-bundle/Admin/Admin.php so you just have to implement the methods postPersist and postUpdate .

If you use doctrine as ORM you can also use the doctrine events postUpdate and postPersist as described in the documentation .

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