EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

GET parameter of entity ID on Index page leads to wrong singular label of NEW action

Open siggidiel opened this issue 1 year ago • 1 comments

Describe the bug When submitting an EDIT page of an entity successfully, EasyAdmin redirects you to the INDEX page but appends a &entityId=1234 query parameter with the ID of the saved entity.

This seems harmless as long as you don't have configured the singular label in your crud controller with additional entity related property infos. Because if you have configured it, this will also be applied to the action button on the INDEX page.

To Reproduce

  • Define crud setting in configureCrud() method as follows (doesn't have to be the entity ID. Can be any property):
    public function configureCrud(Crud $crud): Crud
    {
        return $crud->setEntityLabelInSingular(
            fn (?MyEntity $entity) => 'Singular Word' . ($entity ? ' (' . $entity->getId() . ')' : '')
        );
    }
    
  • Visit INDEX page. The NEW action button has label Add Singular Word
  • Edit an existing entity record
  • Save entity on EDIT page successfully
  • Get redirected to INDEX page with query param &entityId=1234 appended
  • Label of NEW action button is now Add Singular Word (1234)

siggidiel avatar Mar 08 '24 15:03 siggidiel

Unfortunately, this is still present

siggidiel avatar Oct 10 '24 08:10 siggidiel