Zum Inhalt springen

Aspect-Oriented Programming return value

Erstellt am 19. November 2013 · Noch keine Antworten

Tags: Frage

curi0u5 ·

Gibt es eine Möglichkeit per AOP einen Wert in der Methode der Zielklasse zurückzugeben????

Ein Beispiel:
Nach dem Logging soll z.B. ein Value zurückgegeben werden.

namespace Examples\Forum\Logging;

/**
 * @Flow\Aspect
 */
class LoggingAspect {

        /**
         * @Flow\Inject
         * @var \Examples\Forum\Logger\ApplicationLoggerInterface
         */
        protected $applicationLogger;

        /**
         * Log a message if a post is deleted
         *
         * @param \TYPO3\Flow\AOP\JoinPointInterface $joinPoint
         * @Flow\Before("method(Examples\Forum\Domain\Model\Forum->deletePost())")
         * @return void
         */
        public function logDeletePost(\TYPO3\Flow\AOP\JoinPointInterface $joinPoint) {
                $post = $joinPoint->getMethodArgument('post');
                $this->applicationLogger->log('Removing post ' . $post->getTitle(), LOG_INFO);
        }

}