[FLOW3-general] AOP problem
Federico Bernardin
federico at bernardin.it
Thu Dec 17 12:58:20 CET 2009
Hi Robert,
I report my code but before I describe what I'm doing:
I have a normal stupid controller, but I want to intercept a specific method and I want to write in the log (this is my first test of AOP).
I create the specific class:
/**
* Adds the aspect
*
* @aspect
*/
class SecurityAspect {
/**
* @var \F3\FLOW3\Log\LoggerInterface A logger implementation
*/
protected $logger;
/**
* For logging we need a logger, which we will get injected automatically by
* the Object Manager
*
* @param \F3\FLOW3\Log\SystemLoggerInterface $logger The System Logger
* @return void
*/
public function injectSystemLogger(\F3\FLOW3\Log\SystemLoggerInterface $systemLogger){
$this->logger = $systemLogger;
}
/**
* Before advice, logs all access to methods of our package
*
* @param \F3\FLOW3\AOP\JoinPointInterface $joinPoint: The current join point
* @return void
* @after method(.*->.*())
*/
public function logMethodExecution(\F3\FLOW3\AOP\JoinPointInterface $joinPoint){
exit();
$logMessage = 'Checked OK';
$this->logger->log($logMessage);
}
}
As you see I inserted an exit function inside the advice, but it doesn't work.
I printed the list of aspect inside framework.php of AOP package, but there isn't my aspect.
What's wrong?
Thank you
Federico
Il giorno 17/dic/2009, alle ore 09.45, Robert Lemke ha scritto:
Hi Federico,
Am 16.12.2009 um 09:12 schrieb Federico Bernardin:
> I'm starting with developing AOP programming, but it doesn't work.
> I created inside the package a folder "Aspect", inside I created a specific aspect class with one pointcut and one advise (I write the example in the flow3 manual, logger).
>
> Where can I find some examples (complete)?
>
> I don't know if I am worng. Could anyone help me?
A good example for a relatively simple aspect is the LogginAspect in the Security sub package:
https://svn.typo3.org/FLOW3/Packages/FLOW3/trunk/Classes/Security/Aspect/LoggingAspect.php
Look "logManagerLogout" advice is the easiest because it just logs a message after some method
was executed.
If you have any further questions, just post your code so we can see what might be wrong ...
Cheers,
robert
_______________________________________________
FLOW3-general mailing list
FLOW3-general at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
Bernardin Ing. Federico
Consulenza Informatica
via San Luigi 3
P.IVA: 03692850286
35030 Selvazzano Dentro (PD)
Fax 0497964921
federico at bernardin.it
Questa e-mail ed i suoi eventuali allegati contengono informazioni riservate o confidenziali. Se avete ricevuto questa comunicazione per errore, siete pregati di non utilizzarne il contenuto e di non portarlo a conoscenza di alcuno. Grazie per la collaborazione.
This message is intended only for the use of the individual or entity to which it is addressed, and may contain confidential information. If you received this in error, please contact the sender and delete the material from all computers
More information about the FLOW3-general
mailing list