Feature Request: Native Support for Embedded Entity Detail View in AssociationField
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
Research direction
Start with AssociationField and the existing renderAsEmbeddedForm() path, then trace EntityFactory::createForEntityInstance(), FieldFactory::processFields(), and the render_field_contents macro. Done means a native detail-page API reusing associated CRUD detail configuration while excluding hidden and layout fields and handling null associations; the issue names no specific files or tests.
Written by the indexing model from the issue text.
Description
Use Case
When displaying an associated entity in a detail page, we often want to show all its fields directly in the detail view, not just a link. This is similar to renderAsEmbeddedForm() for forms, but for detail pages.
Current Workaround
To achieve this, we need to:
- Create a custom Twig component/service that:
- Retrieves the field configuration from the associated entity's CRUD controller
- Uses
EntityFactory::createForEntityInstance()andFieldFactory::processFields()to generateFieldDtoobjects - Filters out layout fields and fields hidden on detail pages
- Renders fields using EasyAdmin's
render_field_contentsmacro
- Create a custom template that calls this component
- Configure the
AssociationFieldto use this custom template viasetTemplatePath()
This works but requires significant boilerplate and deep knowledge of EasyAdmin internals.
Proposed Solution
Add a method similar to renderAsEmbeddedForm() but for detail pages:
yield AssociationField::new('fitnessProfile')
->renderAsEmbeddedDetail(FitnessProfileCrudController::class)
->onlyOnDetail();
This would:
- Automatically fetch and render all fields configured for the detail page of the associated entity
- Use the same field configuration, formatting, and rendering logic as the main detail page
- Maintain consistency with EasyAdmin's UI and behavior
- Handle edge cases (null associations, hidden fields, layout fields, etc.)
Benefits
- Consistency: Uses the same field configuration and rendering as the main detail page
- Maintainability: Changes to the associated entity's field configuration are automatically reflected
- Simplicity: No custom code needed for a common use case
- Type safety: Leverages existing EasyAdmin infrastructure
Implementation Notes
- Should reuse existing
EntityFactoryandFieldFactorylogic - Should respect field visibility settings (
onlyOnDetail(),hideOnDetail(), etc.) - Should filter out layout fields (tabs, panels, etc.)
- Could optionally support a subset of fields via a parameter
This would complement renderAsEmbeddedForm() and provide a native way to display embedded entity details without custom workarounds.
Thank you in advance
- Dominant language
- PHP
- Stars
- 4.3k
- Forks
- 1.1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 52
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EasyCorp/EasyAdminBundle
-
bug design
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
EasyCorp/EasyAdminBundle#7958 ·
Maintainers usually reply within 2 days
-
design feature
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
EasyCorp/EasyAdminBundle#7930 ·
Maintainers usually reply within 2 days
-
design
Difficulty 2/5 Under an hour Newbie friendliness 88/100
EasyCorp/EasyAdminBundle#7879 ·
Maintainers usually reply within 2 days
-
design
Difficulty 1/5 Under an hour Newbie friendliness 90/100
EasyCorp/EasyAdminBundle#7875 ·
Maintainers usually reply within 2 days
-
#[AdminRoute]: the requirements of an action silently replace the ones of the classPossibly taken @anthonyhacart claimed this 1 day ago. Openfeature
Difficulty 3/5 Half a day Newbie friendliness 30/100
EasyCorp/EasyAdminBundle#7956 ·
Maintainers usually reply within 2 days
All issues in EasyCorp/EasyAdminBundle
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
area/import type/enhancement when/later
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
parime/glpi-iso27001-management#1165 ·
Maintainers usually reply within 1 day
-
15.0
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
opnsense/plugins#5976 · 1 comment ·
Maintainers usually reply within 1 day