简体   繁体   中英

Sonata Admin redirect from preRemove

I have a Entity Group that has an ArrayCollection of Members.

Now I count my Members in preRemove of Member and Remove the Group, if the count is zero.

If I now remove all members from the group in Sonata Admin and click "Save", the Group was removed, but Sonata Admin crashs, because the group doesnot exists any more.

Is there a way to redirect to the List when I delete the group on saving?

Hard to answer without the code but the answer should be in your controller. After testing if the group still exists:

return $this->redirect($this->generateUrl('my_list_route'));

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