EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

Admin Url Fix for linking from Edit/Detail to Index pages.

Open bytes-commerce opened this issue 10 months ago • 0 comments

Scenario:

  • have two entity CRUD forms
  • have some entities in Entity 1
  • have a few, or none in Entity 2
  • have a association or relation to Entity 2 from Entity 1, but allow it to be null and let it be null (no links existing)
  • have a link to the Crud Index for Entity 2 in the Form of Entity 1 (when updating / FK existing)
  • click the link

Expected result:

  • you get redirected to the Index Page of the desired CRUD

Result:

  • Exception, as the FK of Entity 1 does not exist in Entity 2
  • and if it would, it would be the wrong one, but thats not a bug / exception

The main point is that the current setup assumes that there will always be existing links. Since non-referring pages like the Index do not need the entityId parameter, we can unset it when the scenario is matched (URL goes to Index, EntityId is set).

bytes-commerce avatar Apr 10 '24 07:04 bytes-commerce