GithubHelp home page GithubHelp logo

Comments (11)

atompulse avatar atompulse commented on June 15, 2024

Any ideas? I'm in very bad position and had investigated the code but cant figure out the issue...

from goaop-symfony-bundle.

atompulse avatar atompulse commented on June 15, 2024

News: I tested with plain simple symfony demo app 3.2 (without any of my dependencies and code, wanted to make sure there's no hidden red herings) and I can confirm the issue is consistent:

  • if kernel is not in debug mode, the aop doesnt work, fails silently, no errors emited, although proxy classes are correctly generated and in place
    -if kernel is in debug mode, everything works as expected

Sample aspect I'm using for test:

<?php
namespace AppBundle\Aop;

use Go\Aop\Aspect;
use Go\Aop\Intercept\MethodInvocation;
use Go\Lang\Annotation\Before;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

/**
 * Class Signal
 * @package AppBundle\Aop
 *
 */
class Signal  implements Aspect
{
    use ContainerAwareTrait;

    /**
     * @param MethodInvocation $invocation
     * @Before("execution(public AppBundle\Controller\BlogController->postShowAction(*))")
     */
    public function beforeMethod(MethodInvocation $invocation)
    {
        $this->container->get('logger')->error('-----executed signal-----');
    }
}

config.yml

go_aop:
    cache_warmer: true
    options:
        debug: %kernel.debug%
        app_dir: "%kernel.root_dir%/../src/"
        cache_dir: %kernel.cache_dir%/aspect
        include_paths: ["%kernel.root_dir%/../src/AppBundle/Controller"]
        exclude_paths: []
        features: []

services.yml

    signal.aspect:
      class:  AppBundle\Aop\Signal
      calls:
        - [setContainer, ['@service_container']]
      tags:
        - { name: goaop.aspect }

from goaop-symfony-bundle.

lisachenko avatar lisachenko commented on June 15, 2024

Hi! From your issue it's unclear what is your version of goaop/framework and goaop/goaop-symfony-bundle itself?

It's very hard to guess, why it isn't working. Just several points to check:

  • do you use inlining of classes in your bundle (eg. classes.php) or not.
  • put a breakpoint into the GoAopBundle->boot() method. Is it called or not? If not, then AOP is not initialized, but it's very strange.

from goaop-symfony-bundle.

atompulse avatar atompulse commented on June 15, 2024

First of all, thanks for the suggestions.

Related to versions:
"symfony/symfony": "^3.2"
"goaop/goaop-symfony-bundle": "2.*"
these were the versions used for the plain simple test without any of my code.
But the same issue is replicated using symfony ^2.8 and the same goaop-symfony-bundle.

I already tried the breakpoint at boot and in many other places, I can confirm the bundle is successfully booted, again it works perfectly when in debug mode (i.e. $kernel = new AppKernel('prod', **true**); )
About the inlining of classes I'm not sure what you mean, every class is in its own file; you can see the example I'm giving above with the default symfony 3.2 blog demo app.

From what I learned up to this point, it seems very possible that there's a problem related to loading the classses in debug mode vs non-debug mode.
Using XDebug I can see that when using kernel debug mode the proxy classes are used, but not when using the non-debug mode, although the bundle is correctly loaded and all the rest.

from goaop-symfony-bundle.

lisachenko avatar lisachenko commented on June 15, 2024

About the inlining of classes I'm not sure what you mean, every class is in its own file; you can see the example I'm giving above with the default symfony 3.2 blog demo app.

I was referring to the adding classes to the compiled cache technique.

Anyway, if each single class in it's own file and standard autoloader is used then everything should work. I'll try to reproduce your issue myself. Looks like this can be related to the mapping relative paths from the composer to real one.

Last check: could you please install goaop/framework from the master branch to be sure, that this issue isn't fixed yet in the framework

from goaop-symfony-bundle.

atompulse avatar atompulse commented on June 15, 2024

Installed version for framework is 2.0.0
Should i try a different version?

PS: very easy setup to verify, just setup the default demo blog app with the symfony installer and use the details I gived above.

from goaop-symfony-bundle.

lisachenko avatar lisachenko commented on June 15, 2024

Installed version for framework is 2.0.0
Should i try a different version?

Yes, please: composer require goaop/framework:2.0.x-dev

from goaop-symfony-bundle.

atompulse avatar atompulse commented on June 15, 2024

Hi @lisachenko ,
I forced the oaop/framework:2.0.x-dev usage and indeed the issue vanished.

Could you please push this fix to the stable release? It should stop people getting into the same problem that I did.

Anyways, thank you for your support and awesome work on this library 👍

Cheers!

from goaop-symfony-bundle.

lisachenko avatar lisachenko commented on June 15, 2024

Hi, @atompulse! Thank you for checking, I will prepare a tag then (probably on weekends, need to recheck all issues).

For now, you could use dev-version for short period of time.

Thank you for issue reporting!

from goaop-symfony-bundle.

lisachenko avatar lisachenko commented on June 15, 2024

Version 2.1.0 is released. Now you can switch to the stable tag. Thank you!

from goaop-symfony-bundle.

atompulse avatar atompulse commented on June 15, 2024

@lisachenko Thank you!

Could you please also update this bundle to require the 2.1 version?
👍

from goaop-symfony-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.