janalis / easyadmin-embedded-list
Embedded lists for EasyAdmin forms: show a related entity's own CRUD index, paginated, sortable and filterable, inside an edit form.
Package info
github.com/janalis/easyadmin-embedded-list
Type:symfony-bundle
pkg:composer/janalis/easyadmin-embedded-list
Requires
- php: ^8.4
- doctrine/orm: ^3.3
- easycorp/easyadmin-bundle: ^5.6
- symfony/asset-mapper: ^7.4 || ^8.0
- symfony/config: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/event-dispatcher: ^7.4 || ^8.0
- symfony/form: ^7.4 || ^8.0
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/http-foundation: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/options-resolver: ^7.4 || ^8.0
- symfony/twig-bundle: ^7.4 || ^8.0
- twig/twig: ^3.12
Requires (Dev)
- carthage-software/mago: ^1.30
- doctrine/doctrine-bundle: ^2.13 || ^3.0
- infection/infection: ^0.35.8
- phpunit/phpunit: ^12.5
- symfony/browser-kit: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/css-selector: ^7.4 || ^8.0
- symfony/security-bundle: ^7.4 || ^8.0
- symfony/security-csrf: ^7.4 || ^8.0
- symfony/translation: ^7.4 || ^8.0
- symfony/yaml: ^7.4 || ^8.0
Suggests
- symfony/security-csrf: Keeps the CSRF tokens a list renders out of the session
Provides
None
Conflicts
None
Replaces
None
README
easyadmin-embedded-list
Lists inside EasyAdmin forms.
A related entity's own CRUD index · paginated, sorted, with its row actions · upstream EasyAdmin, no fork
Documentation · Getting started · Configuration · JavaScript events
janalis/easyadmin-embedded-list is a Symfony bundle that shows a
collection of the entity being edited, in an EasyAdmin
form, as the index page of the collection's own CRUD controller: editing an
author, you see and manage their books as the book index shows them.
- The target's own index: its columns, sorting, pagination and row actions, filtered on the edited entity, loaded into the form and kept there as you page and sort.
- Mapped or computed collections: a Doctrine collection finds its CRUD controller and filter from the mapping; a computed one names them.
- Row actions in place: a confirmed delete runs without leaving the form and reloads the list; a cancelled confirmation of the page never runs with it.
- No session lock: each list releases the session as soon as the user is loaded, so the lists of a page load side by side.
- Configurable: the fragment header and layout, the field's template and columns, filters and batch actions in lists, in-place actions, the session handling.
Install
composer require janalis/easyadmin-embedded-list
Requires PHP 8.4+, Symfony 7.4 or 8, EasyAdmin 5.6+, Doctrine ORM 3 and AssetMapper.
Quick start
The target CRUD controller filters on the association back to the edited entity:
final class BookCrudController extends AbstractCrudController { public function configureFilters(Filters $filters): Filters { return $filters->add(EntityFilter::new('author')); } }
The edited entity's CRUD controller shows the collection:
use Janalis\EasyAdminEmbeddedList\Field\EmbeddedListField; final class AuthorCrudController extends AbstractCrudController { public function configureFields(string $pageName): iterable { yield TextField::new('name'); yield EmbeddedListField::new('books', 'Books'); // A collection Doctrine does not map names its CRUD controller and filter. yield EmbeddedListField::new('reviews', 'Reviews') ->setEmbeddedController(ReviewCrudController::class, 'author') ->setVirtual(true); } }
Configuration
Every option has a default; see Configuration.
easyadmin_embedded_list: fragment: { header: X-EA-Fragment, filters: false, batch_actions: false } field: { columns: 'col-md-7 col-xxl-6' } inline_actions: true session: true
Contributing
make install make verify
See CONTRIBUTING.md and the contributor guide.
License
MIT.