Replies: 1 comment
-
The Even if you could still override those methods, it would always feel hacky and you would probably get a few errors from time to time, due to the code not expecting the admin class to change depending on the route. What i would suggest instead is having two different admins, one for your list and batch actions and one for you create, edit, show and delete actions. (Literally configure one admin for your entity and one for your DTO) Basically you have two admins that both use the same controller, but the controller selects the admin based on the current route / action. One drawback i see is that this would result in two routes for each action, e.g. |
Beta Was this translation helpful? Give feedback.
-
Hello,
we would like to migrate from our custom administration to Sonata Admin. Currently I'm trying to adapt the Sonata to our needs, but we could use some help.
Our workaround is:
For every entity we have DataObject which is created from our Factory method. The saving is then done using the method in Facade. For Example for Product entity:
For list objects in datagrid/filtering we want to use entities.
At the moment we are a bit at an impasse because of some of the methods that are final. In the past, there was a way to do this using the https://github.com/mishaklomp/SonataDtoModelManager/blob/master/README.md extension, which did +- the same thing. I know that I can implement custom AdminInterface, but I'm trying to find simplest way to achieve my requirements.
Currently I'm stuck with
getFormBuilder
method where isdata_class
set by function$this->getClass()
and I'm not able to set my DataObject to the form.I would like to ask if it would be possible to do something like this without having to implement the whole AbstractAdmin class.
Thank you for your answers
Beta Was this translation helpful? Give feedback.
All reactions