【问题标题】:Symfony2: Bundle does not existSymfony2:捆绑包不存在
【发布时间】:2016-03-16 16:14:08
【问题描述】:

我有这个问题:

InvalidArgumentException: Bundle "DipUserBundle" does not exist or it is not enabled.

顺便说一句,我在 Dip 命名空间中有两个捆绑包。这两个都是我通过控制台制作的。

拜托,有没有人可以帮助我..这是我的代码!天呐

config.yml

orm:
    auto_generate_proxy_classes: %kernel.debug%
    default_entity_manager: default
    entity_managers:
    default:
    mappings:
        # ...
    DipBiznisBundle: ~
    DipUserBundle: ~

AppKernel.php

class AppKernel extends Kernel {
    public function registerBundles() {
        $bundles = array(
            ...
            new Dip\BiznisBundle\DipBiznisBundle(),
            new Dip\UserBundle\UserBundle(),
        );

routing.yml

homepage:
pattern: /
defaults: { _controller: DipUserBundle:Default:index }

UserBundle.php

<?php
    namespace Dip\UserBundle;
    use Symfony\Component\HttpKernel\Bundle\Bundle;

    class UserBundle extends Bundle {
    }

【问题讨论】:

    标签: symfony bundle


    【解决方案1】:

    如果您将文件和 BiznisBundle 重命名为 DipBiznisBundle 并将 UserBundle 重命名为 DipUserBundle...,您的问题将得到解决...以避免将来使用 generate 命令生成捆绑包时出现问题,并且将使用斜杠而不是反斜杠定义命名空间......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-27
      • 1970-01-01
      • 1970-01-01
      • 2012-02-19
      • 2016-02-09
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      相关资源
      最近更新 更多