[Flow] AOP Pointcut expression witch multiple method names

Beat Guggisberg beat.guggisberg at eglionline.ch
Mon Jun 22 17:15:19 CEST 2015


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


More information about the Flow mailing list