Feature #3650

AOP proxies support classes implementing an interface declaring a __construct() signature

Added by Robert Lemke over 10 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Should have
Category:
AOP
Start date:
2009-06-12
Due date:
% Done:

100%

PHP Version:
Has patch:
Complexity:

Description

Currently AOP proxy classes add a few parameters to the constructor in order to inject the Object Manager and the Object Factory. The drawback is however that such a constructor won't be compatible to a possible interface which declared a certain constructor signature.

The Adviced and Empty Constructor Builder (and the Proxy Class Template) should be modified in a way that the parameters of a __construct() method are identical to that of the target class.

  • One way to do that is to not call parent::__construct() in the proxy's constructor but save the passed arguments temporarily. The constructor returns without any further action.
  • The Object Manager and Object Factory can be injected either through a injectFLOW3_AOP_Proxy_ObjectManager() method or by annotating the property $FLOW3_AOP_Proxy_ObjectManager with some @inject annotation.
  • The parent constructor is called after all dependencies have been injected and the AOP proxy class has been prepared. That could be before or right at the beginning of initializeObject().

The question is what consequences it would have if the constructor of the target class actually is called after all inject methods.

Associated revisions

Revision bf4790b5 (diff)
Added by Andreas Förthner over 10 years ago

  • [+FEAT]: FLOW3 (AOP): AOP proxies now support classes implementing an interface declaring a __construct() signature. Resolves #3650
  • [+FEAT]: FLOW3 (Object): The object manager handles the new AOP proxies.
  • [TASK]: FLOW3 (Persistence): Changed some fixtures to comply to the now AOPProxyInterface.

Revision 8f871cc5 (diff)
Added by Karsten Dambekalns over 10 years ago

[FIX] FLOW3 (AOP): Fixed changes introduced with r2640, fixes #3650
[FIX] FLOW3 (Object): Fixed changes introduced with r2640, fixes #3650
[TASK] TYPO3CR (Tests): Adjusted tests and fixtures to comply with new solution for #3650

History

#1 Updated by Robert Lemke over 10 years ago

  • Assignee changed from Robert Lemke to Andreas Förthner

#2 Updated by Karsten Dambekalns over 10 years ago

  • Status changed from New to Accepted

#3 Updated by Andreas Förthner over 10 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r2640.

#4 Updated by Karsten Dambekalns over 10 years ago

  • Status changed from Resolved to Accepted
  • Assignee changed from Andreas Förthner to Karsten Dambekalns
  • % Done changed from 100 to 90

Almost, but the original constructor is never called, unless it is advised with anything calling proceed() it seems. Fix is being worked on.

#5 Updated by Karsten Dambekalns over 10 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 90 to 100

Applied in changeset r2673.

Also available in: Atom PDF