Feature #37373

Make annotation overrides / "injection" via Objects.yaml possible

Added by Karsten Dambekalns about 3 years ago. Updated about 2 years ago.

Status:Under Review Start date:2012-05-21
Priority:Should have Due date:
Assigned To:Marc Neuhaus % Done:

0%

Category:Configuration
Target version:-
PHP Version: Complexity:
Has patch:No

Description

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.


Related issues

related to TYPO3.Flow - Bug #27045: Introduced properties are not available in the reflection... New 2011-05-26
related to TYPO3.Flow - Feature #35354: Additional variants to annotate Validators Closed 2012-03-29
related to TYPO3.Flow - Feature #37372: Inheritance in ORM should be configured automatically Accepted 2012-05-21
related to TYPO3.Flow - Bug #39413: AOP: Property introduction seems to be broken Resolved 2012-07-31
duplicated by TYPO3.Flow - Feature #39661: It should be Possible to change Annotations through Objec... Closed 2012-08-09

History

#1 Updated by Karsten Dambekalns about 3 years ago

Implementation idea: only ReflectionService needs to know about this, could even offer a way to get rid of specialized handling for things like scope in Objects.yaml.

#2 Updated by Adrian Föder about 3 years ago

I already mentioned such an idea; so an additional suggestion for this: This feature, imo, must come with a Shell command that shows current annotations and their origin, because "annotations" now/than can have various origins.

#3 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from New to Under Review

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#4 Updated by Karsten Dambekalns almost 3 years ago

  • Assigned To set to Marc Neuhaus

#5 Updated by Gerrit Code Review almost 3 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#6 Updated by Gerrit Code Review almost 3 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#7 Updated by Gerrit Code Review almost 3 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#8 Updated by Gerrit Code Review almost 3 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#9 Updated by Gerrit Code Review almost 3 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#10 Updated by Gerrit Code Review almost 3 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#11 Updated by Gerrit Code Review almost 3 years ago

Patch set 9 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#12 Updated by Gerrit Code Review almost 3 years ago

Patch set 10 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#13 Updated by Christopher Hlubek almost 3 years ago

Can we also set the arguments of the annotations? Just adding an annotation might not be enough for most cases (e.g. validation). Maybe I missed that in the change or in the test.

#14 Updated by Christopher Hlubek almost 3 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).

#15 Updated by Marc Neuhaus almost 3 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;

#16 Updated by Gerrit Code Review almost 3 years ago

Patch set 11 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#17 Updated by Marc Neuhaus almost 3 years ago

I've just pushed a new patch which renders the annotations in the proxies like this:

https://gist.github.com/3931158

:)

#18 Updated by Gerrit Code Review over 2 years ago

Patch set 12 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13549

#19 Updated by Karsten Dambekalns over 2 years ago

  • Target version changed from 2.0 beta 1 to 2.1

#20 Updated by Robert Lemke about 2 years ago

  • Target version deleted (2.1)

Also available in: Atom PDF