Feature #37373

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

Added by Karsten Dambekalns 12 months ago. Updated 5 months ago.

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

0%

Category:Configuration
Target version:TYPO3 Flow Base Distribution - 2.1
PHP Version: Complexity:
Has patch:No
Votes: 1 (View)

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

History

Updated by Karsten Dambekalns 12 months 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.

Updated by Adrian Föder 12 months 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.

Updated by Gerrit Code Review 9 months 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

Updated by Karsten Dambekalns 9 months ago

  • Assignee set to Marc Neuhaus

Updated by Gerrit Code Review 9 months ago

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

Updated by Gerrit Code Review 9 months ago

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

Updated by Gerrit Code Review 9 months ago

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

Updated by Gerrit Code Review 9 months ago

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

Updated by Gerrit Code Review 9 months ago

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

Updated by Gerrit Code Review 8 months ago

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

Updated by Gerrit Code Review 8 months ago

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

Updated by Gerrit Code Review 8 months ago

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

Updated by Christopher Hlubek 7 months 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.

Updated by Christopher Hlubek 7 months 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 7 months 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;

Updated by Gerrit Code Review 7 months ago

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

Updated by Marc Neuhaus 7 months ago

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

https://gist.github.com/3931158

:)

Updated by Gerrit Code Review 6 months ago

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

Updated by Karsten Dambekalns 5 months ago

  • Target version changed from 2.0 beta 1 to 2.1

Also available in: Atom PDF