Search code examples
sonata-adminsymfony-sonatasonata-user-bundle

customise message when add update delet entity using sonatadminbundle


hi i use sonatadminbundle to manage my entities i works very good. but i want to customise message when adding deleting updating my entity by default it look like this AppBundle\Entity\Product:000000000727a2de000000005cccd6bd Item "AppBundle\Entity\Product:000000004284b7de00000000791d9693" has been successfully updated. i want to add my own message thisis my dashboard enter image description here


Solution

  • The success message is a standard symfony Flash message. The messages are set in Sonata\AdminBundle\Controller\CRUDController with keys : sonata_flash_success / sonata_flash_error / sonata_flash_info and associated with a generic translation.

    You can override the translations, or if you want you can override the appropriate action in the admin controller and do what you want. You can also start by adding a _toString() function to your entity which is much better than "AppBundle\Entity\Product:000000000727a2de000000005cccd6bd"