[FLOW3-general] Introduce Method WITH parameters via AOP Advice and Interface

Andreas Förthner andreas.foerthner at netlogix.de
Mon Oct 31 12:44:14 CET 2011


Hi Torsten,

this is a known bug. There is already a change in gerrit, that should fix
the issue: https://review.typo3.org/#change,5395

Can you try it and maybe add your vote to the change? That would be great!

Greets Andi

Am 31.10.11 12:24 schrieb "Torsten Blindert" unter
<register at by-torsten.de>:

>
>I'm referring to this Part:
>http://flow3.typo3.org/documentation/guide/partiii/aspectorientedprogrammi
>ng.html#interface-introduction
>
>It says
>
>/**
>         * Around advice, implements the new method "newMethod" of the
>         * "NewInterface" interface
>         *
>         * @param  \TYPO3\FLOW3\AOP\JoinPointInterface $joinPoint The
>current join point
>         * @return void
>         *
>@FLOW3\Around("method(Example\MyPackage\OldClass->newMethod())")
>         */
>        public function
>newMethodImplementation(\TYPO3\FLOW3\AOP\JoinPointInterface $joinPoint) {
>                        // We call the advice chain, in case any other
>advice is declared for
>                        // this method, but we don't care about the
>result.
>                $someResult =
>$joinPoint->getAdviceChain()->proceed($joinPoint);
>
>                $a = $joinPoint->getMethodArgument('a');
>                $b = $joinPoint->getMethodArgument('b');
>                return $a + $b;
>        }
>
>Which suggests, that a new method looking something like this is
>introduced:
>
>public function newMethod($a, $b);
>
>And this I like to achieve too.
>
>To be more concretely, I want to add an protected variable, a getter and
>a setter to security context. New variable and getter can be easily
>achieved with AOP, but the setter needs to have a parameter
>(obviously)... and thats seems to be impossible. Currently I make use of
>\TYPO3\FLOW3\Reflection\ObjectAccess->setProperty which is not as elegant
>as using a "real" setter method.
>
>Torsten
>
>On 31.10.2011, at 11:10, Bastian Waidelich wrote:
>
>> Torsten Blindert wrote:
>>
>> Hi Torsten,
>>
>>> if method introductions with parameters aren't currently supported,
>>> than the example snipped in the AOP part of the documentation is
>>>wrong. [...]
>>
>>> $joinPoint->getMethodArgument('a')
>>
>> The example in the documentation is about *advising* methods and
>>accessing their parameters, not about introducing new parameters. But
>>probably we've just got our wires crossed. What do you want to achieve
>>and do you have a snippet of your code?
>>
>> Bastian
>>
Andreas Förthner
Leiter Web-Entwicklung

Telefon: +49 (911) 539909 - 0
E-Mail: andreas.foerthner at netlogix.de
Website: media.netlogix.de


--
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Andernacher Straße 53 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



_______________________________________________
>> FLOW3-general mailing list
>> FLOW3-general at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>
>_______________________________________________
>FLOW3-general mailing list
>FLOW3-general at lists.typo3.org
>http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general



More information about the FLOW3-general mailing list