安装期间Symfony SonataMediaBundle ClassNotFoundException错误

时间:2017-08-17 10:52:57

标签: symfony sonata-media-bundle

我的第一个symfony项目再次出现问题。我将尝试安装SonataMediaBundle。我已经安装了SonataAdminBundle,它运行正常。我尽力使用那条指令https://sonata-project.org/bundles/media/3-x/doc/reference/installation.html,但我需要在AppKernel中添加一行

new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(),

尝试更新我的数据库架构时出现错误:

Uncaught ClassNotFoundException自动从名称空间“Application \ Sonata \ MediaBundle”加载类“ApplicationSonataMediaBundle”。您是否忘记将语句用于其他命名空间? 在我的项目/ src中,我有AppBundle和Application目录。为什么我有这个错误?和MediaBundle需要ClassificationBundle来处理属性吗?

1 个答案:

答案 0 :(得分:0)

检查 composer.json

中是否存在捆绑包的名称
php composer.phar update
php composer.phar require

然后更新作曲家:

select zipcode, jsonb_object_agg(category, total)
from (
        select zipcode, category, count(*) as total
        from
            locations l
            inner join
            categories c on l.type = c.item
        group by zipcode, category
    ) a
    right join (
        (select distinct category from categories) c
        cross join
        (select distinct zipcode from locations) l
    ) dc using (zipcode, category)
group by zipcode
;
 zipcode |     jsonb_object_agg     
---------+--------------------------
    9876 | {"car": 1, "food": 1}
    5678 | {"car": null, "food": 1}
    1234 | {"car": 1, "food": 2}