ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 3 replies, has 2 voices, and was last updated by Jaimy Jaimy 3 years, 6 months ago.

  • Creator
    Topic
  • #1468
    Jaimy
    Jaimy
    Participant

    Hi fellow oro’ers,

    I’ve been working on a small project and noticed something weird when generating the bundle from commandline.

    In the ORO platform v1.0.0-alpha5 the bundles are correctly registered, but there have been a whole bunch of improvements since. I’m not sure whether this is a Symfony bug or a ORO bug (maybe it’s not even a bug?). Below I will give a step by step on what I’ve done to generate the bundle:

    1. In terminal:app/console generate:bundle

    To generate a new bundle in symfony.

    2. For this example I’ve used the bundle namespace “Acme/Bundle/BlogBundle” to see whether this is a generic error or just my incompetence ;):)

    3. I’ve used the suggested bundle name “AcmeBlogBundle”

    4. The target directory is the default directory for Bundles, in my case this is “/Users/jaimy/Development/oro-beta4/src”

    5. The format for the generated configuration is “yml”

    6. I want to generate the whole directory structure so the paramater is “yes”

    7. Confirm the generation => “yes”

    Next it will generate the bundle and I’ve confirmed that I want to register the bundle in the AppKernel and I want to update the routing automaticly.
    Bundle generation

    Generating the bundle code: OK
    Checking that the bundle is autoloaded: OK
    Confirm automatic update of your Kernel [yes]?
    Enabling the bundle inside the Kernel: OK
    Confirm automatic update of the Routing [yes]?
    Importing the bundle routing resource: OK

    9. So everything went “OK” according to the generation script, except that when I look in the /app/AppKernel.php I notice that my bundle (Acme/Bundle/BlogBundle) is not added properly to the other bundles.class AppKernel extends OroKernel
    {
    public function registerBundles()
    {,
    new Acme\Bundle\BlogBundle\AcmeBlogBundle(),
    $bundles = array();

    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
    $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
    $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }

    if (in_array($this->getEnvironment(), array('test', 'perf'))) {
    $bundles[] = new Oro\Bundle\TestFrameworkBundle\OroTestFrameworkBundle();
    }

    return array_merge(parent::registerBundles(), $bundles);
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
    $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
    }

    So I’m not sure what happened but this is not correct :P. Since I’m getting the error: Parse error: syntax error, unexpected ',' in /Users/jaimy/Development/oro-beta4/app/AppKernel.php on line 11

    which is expected. Anyone else experiencing this issue/bug?

    ##updated with some images for visual support
    Complete walk through bundle generation
    Complete walk through bundle generation

    AppKernel.php bundle registry
    AppKernel.php bundle registry

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #1472

    Alexandr Smaga
    Participant

    Hello,

    It’s a bug in

    The code there is just looking for variable $bundles that contains array, than parses tokens until ); will found, after that it get the line number decrease by 1 and put following code

    So it will work only in case when $bundles will contain at least one bundle..

    #1603

    Alexandr Smaga
    Participant

    Hi,

    I’ve fixed the issue, and sent pull request to SensioLabs.
    So issue will be solved after it’ll be accepted.

    #1604
    Jaimy
    Jaimy
    Participant

    Hi asmaga,

    Thanks. In the meantime I’ve figured out about the oro-way of loading bundles via bundles.yml in every bundle. This helps as well :).

    Kind Regards,

    Jaimy Casteleijn

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.