Make annotation overrides / "injection" via Objects.yaml possible
Objects.yaml should allow for adding and overriding annotations in classes. This would allow to modify ORM configuration or anything else driven through annotations without touching the code - especially useful for 3rd party code.
Updated by Christopher Hlubek about 8 years ago
The main question for me is, if we want to complicate the whole proxy building even more. Also debugging and traceability is problematic with overriding the annotations in the PHP class. So maybe we should mark the overridden annotations with a comment
What about using the approach of solving the problem at the consumer side? So instead of just asking the ReflectionService about the information, we could introduce another source (e.g. ConfigurationManager) which overrides the data from annotations. The problem for me is that we add almost 1000 lines of code for this change in an area which is really complicated (we had / have a lot of bugs and strange effects in there).
Updated by Marc Neuhaus about 8 years ago
Hmm, that kind of sounds like what i had before ^^
I think for quite complex things like expose it makes sense to have a more high-level api layer above the annotations to use for configurations, but i some cases we might really need a way to change those low-level annotations.
I agree, that debugging gets kind of blurred by this different annotation "sources" and i like the idea to put those information into the proxy through comments. Here's an example i could imagine:
/** * @param string * @Flow\Identity * @ORM\Column(name="baz") * * Overridden Annotations: * @Flow\Validate(type="Email") * @Flow\Validate(type="NotEmpty") * * Removed Annotations: * Flow\Introduce */ protected $mail;