Skip to content

Cant update ActionGroup #7515

@Guilain

Description

@Guilain

Describe the bug

Attempted to call an undefined method named "getAsConfigObject" of class "EasyCorp\Bundle\EasyAdminBundle\Dto\ActionGroupDto".

To Reproduce
Attempt to update an ActionGroup from configureActions

class  UserCrudController  extends AbstractCrudController
{

    #[Override]
    public function configureActions(Actions $actions): Actions
    {
          $notifGroupActions = ActionGroup::new('Notifier')
            ->addAction(Action::new('action1')->linkToCrudAction('doAction1'))
        ;

        return parent::configureActions($actions)
            ->add(Crud::PAGE_INDEX, $notifGroupActions)
            ->add(Crud::PAGE_DETAIL, $notifGroupActions)
        ;
    }

    #[AdminRoute(path: '/{entityId}/doAction1', name: 'doAction1')]
    public function doAction1(AdminContext $adminContext, FirebaseService $firebaseService): RedirectResponse
    {
        // ...
        return $this->redirect($adminContext->getRequest()->headers->get('referer'));
    }
}

class User2CrudController extends UserCrudController
{
    #[Override]
    public function configureActions(Actions $actions): Actions
    {
        $action2= Action::new('action2')->linkToCrudAction('doAction2');

        return parent::configureActions($actions)
            ->update(Crud::PAGE_INDEX, 'action1', fn (ActionGroup $a) => $a->addAction($action2))
            ->update(Crud::PAGE_DETAIL, 'action1', fn (ActionGroup $a) => $a->addAction($action2));
    }

    #[AdminRoute(path: '/{entityId}/doAction2', name: 'doAction2')]
    public function doAction2(AdminContext $adminContext, FirebaseService $firebaseService): RedirectResponse
    {
        // ...
        return $this->redirect($adminContext->getRequest()->headers->get('referer'));
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions