- Issue created by @zaporylie
- Merge request !438Issue #3520439: Expose Availability Checkers in the Admin UI → (Open) created by Unnamed author
- 🇳🇴Norway zaporylie
I published the MR with the proof of concept. Below is a screenshot from UI with the exposed checker from ✨ Add an availability checker which checks if the entity is accessible or not Needs work .
- 🇮🇱Israel jsacksick
Just one word regarding the UI. I believe the helper text should appear before the options, to at least be consistent with the order version mismatch setting.
- 🇮🇱Israel jsacksick
@zaporylie: I kind of changed my mind on this and I now believe we should explore the attributes route as we're here providing metadata which is the right use case for this.
Additionally, I think we should provive an update hook that sets the config based on the available checkers for BC reasons so we don't have to worry about the existing and have conditional logic...Thoughts?
- 🇳🇴Norway zaporylie
I came to the same conclusion about utilizing a custom Metadata attribute. Additionally, I believe the metadata could also include an ID (separate from the service name), which would then be used in the config sequence to mark the checker as enabled or disabled.
I also think that filtering of checkers should happen in the constructor (as originally proposed) to avoid the performance overhead of limiting the list repeatedly during each call to
AvailabilityManagerInterface::check
.The main advantage of using tagged services over plugins is better performance, as tagged services are collected during the container build phase. Introducing extra filtering steps at runtime for every pass would be suboptimal. This approach would only make sense if we were using plugins, which we are not.
- 🇳🇴Norway zaporylie
I’ve updated the PR to use the attribute approach. Generally, it’s working, but there’s a major flaw in the architecture.
Because of how the container works, a single class can represent multiple services. With an immutable Attribute, we lose the ability to vary metadata per service instance.
Given that, I’m considering moving back to the interface approach but using a Metadata value object to keep things cleaner and more structured.
- 🇳🇴Norway zaporylie
We had an internal discussion that triggered a small but mighty change to the scope of this issue. The idea is to toggle availability checkers on a per-order-item-type basis.
The MR is now updated accordingly.