New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Allow to use advisors directly without serialization #142

merged 17 commits into from Apr 18, 2014


1 participant

lisachenko commented Apr 8, 2014

This feature allows to specify custom interceptors with callbacks instead of aspects:

    protected function configureAop(AspectContainer $container)
            new DefaultPointcutAdvisor(
                new TrueMethodPointcut(),
                new MethodBeforeInterceptor(function (MethodInvocation $invocation) {
                    echo "Hello", $invocation->getMethod()->name;

Additionally, this PR replaces unserialization of advices with direct injection of advices if possible. If advisor is not loaded, then special aspect cache is used with serialized advisors and pointcuts per each aspect. So, no more need to analyze annotations in case when a cache of advisors is active.

After merging of this PR it will be possible to create a pointcut builder with DSL and fluent interface. Example:

    protected function configureAop(AspectContainer $container)
        $builder = new PointcutBuilder($container);
        $builder->before('execution(public **->get(*)')->do(function (MethodInvocation $invocation) {
            echo "Hello", $invocation->getMethod()->name;
        $builder->after('access(protected **->propertyName')->do(function (FieldAccess $access) {
            echo "Hello", $access->getField()->name;

@lisachenko lisachenko added this to the 0.5.0 milestone Apr 8, 2014

lisachenko added a commit that referenced this pull request Apr 18, 2014

Merge pull request #142 from lisachenko/feature/direct-advisor
[Feature] Allow to use advisors directly without serialization

@lisachenko lisachenko merged commit 64cc041 into master Apr 18, 2014

2 checks passed

continuous-integration/travis-ci The Travis CI build passed
default Scrutinizer: Errored — Travis: Passed

@lisachenko lisachenko deleted the feature/direct-advisor branch Apr 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment