/**
* Before advice for all methods annotated with "@Flow\Session(autoStart=true)".
* Those methods will trigger a session initialization if a session does not exist
* yet.
*
* @param JoinPointInterface $joinPoint The current join point
* @return void
* @fixme The pointcut expression below does not consider the options of the session annotation – needs adjustments in the AOP framework
* @Flow\Before("methodAnnotatedWith(Neos\Flow\Annotations\Session)")
*/
public function initializeSession(JoinPointInterface $joinPoint)
{
if ($this->session->isStarted() === true) {
return;
}
$objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy()));
$methodName = $joinPoint->getMethodName();
$this->systemLogger->log(sprintf('Session initialization triggered by %s->%s.', $objectName, $methodName), LOG_DEBUG);
$this->session->start();
}