Go AOP не ловит мои аспекты

Я пытаюсь использовать GO AOP, чтобы позволить мне использовать аспекты с проектом PHP, над которым я работаю. Я использовал composer для установки goaop / framework. Я написал файлы для моего аспекта следующим образом. Я знаю, что CalendarController работает, потому что в одной из функций есть эхо, которое я вижу. Вы знаете, почему это не работает?

index.php

// Initialize an application aspect container
$applicationAspectKernel = App\Http\applicationAspectKernel::getInstance();
$applicationAspectKernel->init(array(
'debug' => true, // use 'false' for production mode
// Cache directory
'cacheDir'  => __DIR__ . '/path/to/cache/for/aop',
// Include paths restricts the directories where aspects should be applied, or empty for all source files
'includePaths' => array(
__DIR__ . '/../app'
)
));

MonitorAspect.php

namespace Aspects;

use Go\Aop\Aspect;
use Go\Aop\Intercept\FieldAccess;
use Go\Aop\Intercept\MethodInvocation;
use Go\Lang\Annotation\After;
use Go\Lang\Annotation\Before;
use Go\Lang\Annotation\Around;
use Go\Lang\Annotation\Pointcut;
use Psr\Log\LoggerInterface;

class MonitorAspect implements Aspect
{/**
* Method that will be called before real method
*
* @param MethodInvocation $invocation Invocation
* @Before("execution(public App\Http\Controllers\CalendarController->*(*))")
*/
public function beforeMethodExecution(MethodInvocation $invocation)
{
\Monolog\Handler\error_log("Is this being called at all? Yes");
$obj = $invocation->getThis();
echo 'Calling Before Interceptor for method: ',
is_object($obj) ? get_class($obj) : $obj,
$invocation->getMethod()->isStatic() ? '::' : '->',
$invocation->getMethod()->getName(),
'()',
' with arguments: ',
json_encode($invocation->getArguments()),
"<br>\n";
}
}

applicationAspectKernel.php
namespace App \ Http;

use Go\Core\AspectKernel;
use Go\Core\AspectContainer;
use Aspects\MonitorAspect;

/**
* Description of aspectKernel
*
*
*/
class applicationAspectKernel extends AspectKernel{

/**
* Configure an AspectContainer with advisors, aspects and pointcuts
*
* @param AspectContainer $container
*
* @return void
*/
protected function configureAop(AspectContainer $container)
{
$container->registerAspect(new MonitorAspect());
}
}

Редактировать: Исправлено утверждение @Before.

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …