[Flow] AOP Pointcut expression witch multiple method names
Beat Guggisberg
beat.guggisberg at eglionline.ch
Thu Jun 25 09:05:20 CEST 2015
That works, Thanks.
So it is writen wrong in the Example:
http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/AspectOrientedProgramming.html#after-returning-advice
Regards
Beat
Am Mittwoch, 24. Juni 2015 23:18 CEST, Rémy DANIEL <dogawaf at no-log.org> schrieb:
Hi
You should use parenthesis instead of square brackets :
method(.*->(add|update|remove)())
--
Rémy
2015-06-22 17:15 GMT+02:00 Beat Guggisberg <beat.guggisberg at eglionline.ch>:
>
> Hello
>
> Im programming a logging aspect for repositorys.
> I got i working for one method so far. Now i would like to set the
> expression to match add, update and remove methods.
> So far
> @Flow\Around("within(TYPO3\Flow\Persistence\RepositoryInterface) &&
> method(.*->update())")
> works for the update method.
> As for my understandig of the documentation,
> @Flow\Around("within(TYPO3\Flow\Persistence\RepositoryInterface) &&
> method(.*->[add|update|remove]())")
> should work for those three methods. But it doesnt.
> I also tried
> @Flow\Around("within(TYPO3\Flow\Persistence\RepositoryInterface) &&
> method(.*->[add|update|remove].*())")
>
> Where do i have the error?
>
> Regards
> Beat
>
>
> My Code so far:
>
> <?php
> /**
> * namespace Efkk\Kern\Domain\Repository
> */
> namespace Efkk\Kern\Domain\Repository;
>
> use TYPO3\Flow\Annotations as Flow;
>
> /**
> * Logging Aspect für Repositorys
> *
> * @Flow\Aspect
> */
> class LoggingAspect {
>
> /**
> * Logger
> *
> * @var \Efkk\Kern\Log\RepositoryJsonLoggerInterface
> * @Flow\Inject
> */
> protected $logger;
>
> /**
> * Loggt das ändern eines Objektes
> *
> * @param \TYPO3\Flow\AOP\JoinPointInterface $joinPoint JoinPoint
> * @Flow\Around("within(TYPO3\Flow\Persistence\RepositoryInterface) &&
> method(.*->update())")
> * @return mixed Result of the target method
> */
> public function logUpdate(\TYPO3\Flow\AOP\JoinPointInterface
> $joinPoint) {
> $className = $joinPoint->getClassName();
> $result = $joinPoint->getAdviceChain()->proceed($joinPoint);
> $this->logger->log('Update', LOG_NOTICE, array('className' =>
> $className), '', __CLASS__, __FUNCTION__);
> return $result;
> }
> }
>
> --
>
> Egli's frische Küchenkräuter AG
> Beat Guggisberg
> Informatik
> Riedeggweg 70c
> CH-3020 Riedbach
>
> direkt: +41 31 926 66 47
> Zentrale: +41 31 926 66 66
> Fax: +41 31 926 66 77
> beat.guggisberg at eglionline.ch
> www.eglionline.ch
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
_______________________________________________
Flow mailing list
Flow at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
--
Egli's frische Küchenkräuter AG
Beat Guggisberg
Informatik
Riedeggweg 70c
CH-3020 Riedbach
direkt: +41 31 926 66 47
Zentrale: +41 31 926 66 66
Fax: +41 31 926 66 77
beat.guggisberg at eglionline.ch
www.eglionline.ch
More information about the Flow
mailing list