Bug #39413
AOP: Property introduction seems to be broken
Added by Rens Admiraal almost 10 years ago. Updated almost 8 years ago.
100%
Description
Introducing a property does not work at the moment. The functional tests are passing.
Attached is a Test package as example to show the problem.
Files
Related issues
Updated by Rens Admiraal almost 10 years ago
Extra info: property introduction does work if you also introduce an interface in the aspect. But as there could be usecases where you don't want to introduce methods it should be possible to do without that.
Updated by Rens Admiraal almost 10 years ago
debugged a bit further, seems like getProperties() in the reflectionService does not have the introduced properties during the compile run, so doctrine:migrationgenerate does not pick up the new properties. Might be a good thing if someone more into the reflection / proxy building stuff has a look at this issue.
Updated by Karsten Dambekalns almost 10 years ago
- Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
Updated by Christoph Gross about 9 years ago
Bug still present in current master. Introduced properties are not added by doctrine.
Uncaught Exception The class "CGROSS\Drinkaccounting\Aop\MultiCommunitySupport" is tagged to be an aspect but doesn't contain advices nor pointcut or introduction declarations.
<?php namespace CGROSS\Drinkaccounting\Aop; use TYPO3\Flow\Annotations as Flow; /** * Inject community-attribute to every class * * @Flow\Aspect */ class MultiCommunitySupport { /** * @var string * @Flow\Introduce("class(CGROSS\Drinkaccounting\Domain\Model\User)") */ protected $community; }
Adding a pointcut (even if not used) and the error message is gone BUT the property is still not created by doctrine:update.
<?php namespace CGROSS\Drinkaccounting\Aop; use TYPO3\Flow\Annotations as Flow; /** * Inject community-attribute to every class * * @Flow\Aspect */ class MultiCommunitySupport { /** * A pointcut which matches all guestbook submission method invocations * * @Flow\Pointcut("method(CGROSS\Drinkaccounting\Domain\Model\User->create())") */ public function guestbookSubmissionPointcut() {} /** * @var string * @Flow\Introduce("class(CGROSS\Drinkaccounting\Domain\Model\User)") */ protected $community; }
Updated by Alexander Berl about 9 years ago
There are actually two points where propertyIntroduction is not taken into consideration:
1. At the end of ProxyClassBuilder->buildAspectContainer, the count of propertyIntroductions isn't taken into account before throwing the "doesn't contain advices nor pointcut or introductions" exception.
2. In AspectContainer->reduceTargetClassNames, the targetClassName cache isn't reduced over propertyIntroductions, leading to all classes that are not also subject to another advice or interface introduction to not be considered at all, hence no property is introduced in the proxy class.
I'll provide a change set for that tomorrow. From there on it's maybe easier to find the spot where to put a proper update of the reflectionData.
My current assumption is, that the ReflectionData is collected before the proxy exists and afterwards the reflectionData isn't updated anymore.
Updated by Gerrit Code Review about 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20000
Updated by Gerrit Code Review almost 9 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20000
Updated by Gerrit Code Review almost 9 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20000
Updated by Gerrit Code Review almost 9 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20000
Updated by Gerrit Code Review almost 9 years ago
Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/21418
Updated by Alexander Berl almost 8 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 915b71ce7346b7c6cc33e95ccb9d628f7023bbb1.