[Feature Request] Scoped CRUD / Global Scope for CRUD Controllers

Open
#7,855 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
php, symfony
Domain
backend

Research direction

The issue names no files, classes or tests, so there is no concrete entry point yet. Before any code, a newcomer would need to find how CRUD controllers build their query and where the dashboard main menu is defined, then agree the design with maintainers, since the URL parameter, the 'All' option and per-controller filtering are all open questions. Done means that agreed design is written down or a first prototype is reviewed.

Written by the indexing model from the issue text.

Description

Short description of what this feature will allow to do:

I would like to suggest a feature to define a global scope shared across multiple CRUD controllers, instead of having to implement the same filters in each controller.

I have already encountered this requirement in three different projects.

For example:

  • Annual event management: An application used to manage a festival that takes place every year. Organizers manage participants, workshops, schedules, etc. There is no reason to mix records from different editions on the same CRUD pages.
  • Multi-project management: An application managing multiple projects, where products, services, and other entities belong to a specific project. Users should be able to select a project and only see records related to it across all relevant CRUD controllers.

In my current implementations, I use a global dropdown in the main menu to select the active scope, which is stored in the session. However, this approach has a major limitation: if a user opens multiple browser tabs and changes the scope in one tab, it also affects the others.

A better approach would be to manage the scope through a URL parameter, automatically preserved across EasyAdmin navigation. This would allow users to work with different scopes in separate tabs without conflicts.

Example of how to use this feature

The expected behavior would be:

  • A global dropdown would allow users to select the active scope.
  • The dropdown could also include an optional "All" option to disable scoping and display records from all scopes together.
  • Each CRUD controller could configure whether it uses the global scope and, if so, define how its queries should be filtered based on the selected scope.
  • The selected scope would be preserved in the URL when navigating between CRUD pages.
  • New records could automatically be associated with the selected scope.
  • CRUD controllers not using the scope would remain unaffected.
  • Different browser tabs could use different scopes independently.

Ideally, the scope selector would be configured at the dashboard level, while each CRUD controller would define its own filtering logic.

I think this could be useful for many applications, especially those managing multiple projects, organizations, events, or tenants.

Here is an exemple of how I render scope in my "events management" project main menu (only the CRUDs in red square are filtered by scope):

Main menu Image

Another exemple of design (using menu header style for the dropdown) from another project (red block are scoped CRUDs):

Image Image
Dominant language
PHP
Stars
4.3k
Forks
1.1k
Avg merge
2d 9h
Merged PRs (30d)
52

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EasyCorp/EasyAdminBundle

All issues in EasyCorp/EasyAdminBundle

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.