首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >InvalidArgumentException Synfomy2

InvalidArgumentException Synfomy2
EN

Stack Overflow用户
提问于 2017-07-13 14:12:31
回答 1查看 56关注 0票数 0

我正在尝试创建一个包含以下内容的原则实体:

代码语言:javascript
复制
php app/console doctrine:generate:entity --entity="AWStudio:Category" --fields="name:string(255)" --no-interaction

但我不能,这个回报:

InvalidArgumentException捆绑"AWStudio“不存在或未启用。也许您忘了将它添加到AppKernel.php文件的AppKernel.php()方法中了?

这是我的APPKernel.php

代码语言:javascript
复制
<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function __construct($environment, $debug)
    {
        date_default_timezone_set('Europe/Paris');
        parent::__construct($environment, $debug);
    }

    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new AWStudio\AWCoreBundle\AWCoreBundle(),
            new \FOS\UserBundle\FOSUserBundle(),
            new \AWStudio\AWUserBundle\AWUserBundle(),
            new AWStudio\CKSBundle\AWStudioCKSBundle(),
            new JMS\AopBundle\JMSAopBundle(),
            new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
            new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
            new FOS\JsRoutingBundle\FOSJsRoutingBundle,
            new JMS\SerializerBundle\JMSSerializerBundle(),
            new Liuggio\ExcelBundle\LiuggioExcelBundle(),
            new JMS\TwigJsBundle\JMSTwigJsBundle(),
            new RaulFraile\Bundle\LadybugBundle\RaulFraileLadybugBundle(),
            new JMS\DiExtraBundle\JMSDiExtraBundle($this),
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
            new \Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
            new \Fresh\Bundle\DoctrineEnumBundle\FreshDoctrineEnumBundle(),
            new Corley\MaintenanceBundle\CorleyMaintenanceBundle(),
            new Sonata\CoreBundle\SonataCoreBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Sonata\AdminBundle\SonataAdminBundle()
        );

        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();
        }

        return $bundles;
    }

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

谢谢!:)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-13 14:34:12

您需要向命令提供包的完整名称。AWStudio实际上是您的供应商名称。

我可以看到,AWStudio供应商中有三个包:AWCoreBundleAWUserBundleCKSBundle

假设您希望在AWCoreBundle中添加您的实体,下面是命令:

代码语言:javascript
复制
php app/console doctrine:generate:entity --entity="AWStudioAWUserBundle:Category" --fields="name:string(255)" --no-interaction

注意,AWUserBundle包名位于AWStudio之后。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45083221

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档