-
Notifications
You must be signed in to change notification settings - Fork 66
[POC] let enhancer work with http method aware defaults #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Failing test looks random, but happened the second time tonight. |
Maybe i should create a separate enhancer that works before But the enhancers have no prio ... |
i still like the idea i proposed: a conditional enhancer that can use
different enhancers based on the http method. instead of configuration
what field to update, it would receive a list of method => enhancer
instance and forward to the right enhancer. with one method being
_default to handle fallback if wanted.
that would keep the FieldByClass enhancer as it is before and thus much
simpler.
|
keeping the I try to refrase it:
(i would pass it as an configuratio, but the enhancer understands an array of class => service:action) Doing that transformation would keep the other enhancers as they are. Is it that what you mean? |
See #173 |
@dbu slowly i get your idea, but wouldn't it change the current call behavior and the extension class at all? Currently we are passing the configurations directly into parameters and pass them to the enhancers while their service configuration. What you plan is a thing between the ExtensionClass and the DynamicRouter, which should prepare the configuration values. And that conditional enhancer can be a kind of a chain enhancer, which is called by the dynamic router, which doesn't recognize the change. But don't you think this should be done in a separate Issue/PR? |
in this PR we do not need to worry about configuration of the
RoutingBundle (but anything we can express in objects here will be
possible to model with configuration)
my idea is to have an enhancer that does not do anything itself except
determine which enhancer to call, based on the request method. then we
can leave the current enhancers alone. it makes no sense to merge this
pull request first and then doing it later, because we would revert the
changes of this PR which is unnecessarily complicated.
|
@dbu but some the enhancers expect some parameters we have to be aware of. Even a conditional Enhancer need those. A conditional enhancers need the Information like POST goes on service:postAction to feed the FieldByClass enhancer, that does its job as it used to do. I am completely with you by keeping the enhancers clean as they are. But i would not do some kind of method => enhancer mapping in the code. I think we should pass the name while its Service Definition and ask later isYourName('controller_by_class') while looping through them all. A so called ConditionalEnhancer would do some Kind of normalizing, when the parameters are Method aware. Doing so the enhancers stay, their service derinitions are reduced and we get the conditional behavior. |
@dbu i hopefully did what you whanted. I moved the enhancer sorting and loopging through the enhancers from the That comes with several advantages:
I hopefully get into the direction you whanted it, at least i hope this can be a starting point for a refactoring without reverting to much stuff. PS: Some stuff (docblock, tests) is still missing. |
i tried to show what i imagined in #174 |
…ace for enhancers with mapping
8c026c4
to
56fed00
Compare
solved in #174 |
Try to let the enhancers work in a HTTP method aware manner as discussed in #171