I get the message:
Unable to found a valid admin for the class: Aman\VarshneyBundle\Entity\ArticleTable, get too many admin registered: sonata.admin.appsreview,sonata.admin.review,sonata.admin.article
I am not able to figure out this issue.
you have to specify "admin_code" option in your field definition
in your admin class while building your form
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('user', 'entity', array(), array(
'admin_code' => 'your.user.admin.service'
));
}
It only happens when you have multiple admin classes for the same entity.
I will put code with the use for the 'configureListFields' method, if it's usefull for someone.
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('filename', null, array('admin_code' => 'your.file.admin.service', 'label' => 'File Name'))
->add('parent', 'sonata_type_list', array('admin_code' => 'your.file.admin.service', 'label' => 'Parent File'))
->add('_action', 'actions', array(
'label' => 'Actions',
'actions' => array(
'download' => array(
'template' => 'FileAdminBundle:File:list__action_download.html.twig'
)
)
));
}
As we see, if we have multiple fields, we must put the 'admin_code' in all of them, excepts the actions (if we have it).
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With