Best practice: multiple voters for different items
- Dominant language
- PHP
- Stars
- 1.4k
- Forks
- 189
- PR merge metrics
- No merged PRs in 30d
Description
I have a general question regarding the new matcher/voter system: what if I need a more complex voting mechanism for _some_ items, but not for all of them?
Imagine having some items that need both a route check (as done by the current `RouteVoter`) and then look up something in the database and thus decide if the item is current or not. Since the `RouteVoter` would return `true` or `false` for any item that is tested, there would be no chance for other voters to check anything at all.
Voters also seem not to provide any specific order as the extensions do, so if I don't add them all at the same time I won't know which one comes first.
It seems to me that at the moment there is no other way than to check these things while creating the menu items in the first place. I would love to give the items or the menu system in general some more "intelligence", because this would allow for faster and simpler menu definitions (e.g. in a YAML file) with specific runtime details figured out later.
Is there anything I have missed?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the matcher/voter system and the current RouteVoter behavior. Clarify whether multiple voters should compose, how voter order is determined, and how this applies only to some menu items; completion requires an agreed design before implementation or tests can be scoped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100