简体   繁体   English

Sylius / Symfony无法找到新的控制台生成的包

[英]Sylius / Symfony cannot find new console generated bundles

We're working with Sylius and trying to create new bundles. 我们正在与Sylius合作,并尝试创建新的捆绑包。 Through the console using php bin/console generate:bundle a new bundle is easily createable. 通过使用php bin / console generate:bundle控制台,可以轻松创建一个新的bundle。 however when we try to run the site we get the error: ClassNotFoundException in AppKernel.php line 36: We are registering our new bundle in the AppKernel.php file, and editing the composer.json file to autoload the new bundle but nothing seems to work. 但是,当我们尝试运行该站点时,会出现错误: AppKernel.php第36行中的ClassNotFoundException:我们正在AppKernel.php文件中注册新捆绑软件 ,并编辑composer.json文件以自动加载新捆绑软件,但似乎什么也没有工作。 We have tried every solution mentioned on SO without luck. 我们尝试了SO上提到的所有解决方案,但都没有碰到运气。 Can anyone point us in the right direction? 谁能指出我们正确的方向?

MUCH APPRECIATED-! 非常感激-!

public function registerBundles()
{
    $bundles = [
        new \Sylius\Bundle\AdminBundle\SyliusAdminBundle(),
        new \Sylius\Bundle\ShopBundle\SyliusShopBundle(),
        new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(),
        new \FOS\OAuthServerBundle\FOSOAuthServerBundle(), // Required by SyliusApiBundle
        new \Sylius\Bundle\ApiBundle\SyliusApiBundle(),
        new \AppBundle\AppBundle(),

        //NEW BUNDLE
        new TGB\AmazonBundle\AmazonBundle(),

    ];

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

from our composer.json file 从我们的composer.json文件

"autoload": {
    "psr-4": {
        "AppBundle\\": "src/AppBundle/",
        "TGB\\AmazonBundle\\": "src/TGB/AmazonBundle/"
    },
    "classmap": ["app/AppKernel.php", "app/AppCache.php"]
},

找到了答案,我们需要运行正在缓存的composer dump-autoload ,而不会去寻找需要加载的新类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM