Bug #39413

AOP: Property introduction seems to be broken

Added by Rens Admiraal about 9 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
Reflection
Target version:
-
Start date:
2012-07-31
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

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

Test.zip (7.42 KB) Test.zip Rens Admiraal, 2012-07-31 14:04

Related issues

Related to TYPO3.Flow - Bug #27045: Introduced properties are not available in the reflection service during a compile runNew2011-05-26

Actions
Related to TYPO3.Flow - Feature #37373: Make annotation overrides / "injection" via Objects.yaml possibleUnder ReviewMarc Neuhaus2012-05-21

Actions
#1

Updated by Rens Admiraal about 9 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.

#2

Updated by Rens Admiraal about 9 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.

#3

Updated by Karsten Dambekalns about 9 years ago

  • Project changed from TYPO3 Flow Base Distribution to TYPO3.Flow
#4

Updated by Karsten Dambekalns about 9 years ago

  • Category set to Reflection
  • Has patch set to No
#5

Updated by Robert Lemke almost 9 years ago

  • Assignee set to Robert Lemke
#7

Updated by Christoph Gross over 8 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;

}
#8

Updated by Alexander Berl over 8 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.

#9

Updated by Gerrit Code Review over 8 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

#10

Updated by Gerrit Code Review over 8 years ago

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

#11

Updated by Gerrit Code Review over 8 years ago

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

#12

Updated by Gerrit Code Review over 8 years ago

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

#13

Updated by Gerrit Code Review over 8 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

#14

Updated by Alexander Berl about 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF