Open speller opened 3 weeks ago
linkToCrudAction
seems to be related to action on a specific row of your entity.
You have to disable new button and create another new button to call your custom controller (with route named backoffice_user_create
for example):
public function configureActions(Actions $actions): Actions
{
$customNewAction = Action::new('customNew', 'Add New')
->linkToRoute('backoffice_user_create')->addCssClass('btn btn-primary')->createAsGlobalAction()
;
return $actions
->add(Crud::PAGE_INDEX, $customNewAction)
->disable(Action::NEW)
;
}
Describe the bug When I add a custom action to the NEW page, I'm getting the
entity with "id = 0" does not exist in the database
error when trying to access it.To Reproduce
(OPTIONAL) Additional context
Stack:
The URL that is generated for the action:
http://localhost:7000/dashboard?crudAction=foo&crudControllerFqcn=App%5CController%5CFooCOntroller&entityId=0