Open mhsdesign opened 2 years ago
why do we really need to use an injector to a private property in the
ActionController
?
Because @Flow\Inject
cannot work on a private property, but making it protected would lead to clashes with subclasses already having a $throwableStorage
…
The "proper solution" would be to make the $throwableStorage
protected so subclasses don't even need to inject their own. But this might make it a breaking change?!
or rename the setter and the private property should do too (non breaking)
or rename the setter and the private property should do too (non breaking)
Yes, but to have the ThrowableStorage readily available like the Logger would make sense. This mess is the result of adding the former without realizing it would be very useful to controllers in general…
My personal opinion: I don't particular like inheritance and reusing protected services from above - it just feels dirty.
so I'm okay with the idea to make it private somehow (we could even use constructor injection ...)
on the other hand - if i like it or not - inheritance is already the pattern to use and one cannot dodge it - so it wouldnt harm adding yet another property. (things will never be really encapsulated with inheritance - but thats how we do things for now)
Is there an existing issue for this?
Current Behavior
The
ThrowableStorage
doesnt get injected in a controller which extendsActionController
Expected Behavior
The
ThrowableStorage
is injectedSteps To Reproduce
See above code
Environment
Anything else?
The issue is, that the
ActionController
already defines an inject method for this property.this was done sometime with Flow 6.3 via https://github.com/neos/flow-development-collection/pull/2685
and flows behaviour is correct, if there is an injector/setter - ignore the flow inject annotation. (Flow cannot know that the injector above will only fills in a private property)
https://flowframework.readthedocs.io/en/8.1/TheDefinitiveGuide/PartIII/ObjectManagement.html#property-injection
the question is - why do we really need to use an injector to a private property in the
ActionController
?related issue: https://github.com/neos/neos-development-collection/issues/3858
Workarounds:
$throwableStorage2
or$myThrowableStorage