首页 > 解决方案 > Symfony 包错误 NotFoundException:尝试从命名空间“Toiba\FullCalendarBundle”加载类“FullCalendarBundle”

问题描述

我在 php 7+ 和 symfony 3.4 中编写了一个 webapp,在开发模式下一切正常。

然后我尝试了这个命令:

作曲家安装--no-dev

并且发生了这个错误:

[RuntimeException] 执行 ""cache:clear --no-warmup"" 命令时出错:

致命错误:未捕获的 Symfony\Component\Debug\Exception\ClassNotFoundException:试图从命名空间“Toiba\FullCalendarBundle”加载类“FullCalendarBundle”。您是否忘记了另一个名称空间的“使用”语句?在 F:\wamp64\www\justdrive\app\AppKernel.php:15

我试图修改这个:

"psr-4": {
    "AppBundle\\": "src/AppBundle"
},

对此:

"psr-4": {
    "": "src/"
},

然后执行这个命令:

作曲家转储自动加载

但是在我提到的第一个命令之后我仍然得到同样的错误。

这是我的作曲家 .lock 中的捆绑包

{
            "name": "toiba/fullcalendar-bundle",
            "version": "v6.2.4",
            "source": {
                "type": "git",
                "url": "https://github.com/toiba/FullCalendarBundle.git",
                "reference": "d8b22cc3a159819fa2a4bbd1c7aad026c6bbad74"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/toiba/FullCalendarBundle/zipball/d8b22cc3a159819fa2a4bbd1c7aad026c6bbad74",
                "reference": "d8b22cc3a159819fa2a4bbd1c7aad026c6bbad74",
                "shasum": ""
            },
            "require": {
                "php": "^5.5|^7.0",
                "symfony/framework-bundle": "^3.4|^4.0"
            },
            "require-dev": {
                "phpspec/phpspec": "^2.5"
            },
            "type": "symfony-bundle",
            "autoload": {
                "psr-4": {
                    "Toiba\\FullCalendarBundle\\": ""
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Rebeca Mora Anca",
                    "email": "anca.rebeca@gmail.com",
                    "role": "Developer"
                },
                {
                    "name": "Théo Attali",
                    "email": "theoattali@gmail.com",
                    "role": "Developer"
                }
            ],
            "description": "Symfony integration of FullCalendar.js library. Events can be stored with Doctrine, MongoDB, CouchDB and others",
            "homepage": "https://github.com/toiba/FullCalendarBundle",
            "keywords": [
                "calendar",
                "fullcalendar",
                "jquery calendar",
                "symfony calendar"
            ],
            "abandoned": "https://github.com/tattali/CalendarBundle",
            "time": "2018-08-09T18:06:32+00:00"
        }

这是 appkernel.php 中的包

public function registerBundles()
    {
        $bundles = [
...
new Toiba\FullCalendarBundle\FullCalendarBundle(),
...
];

你能帮我么?

标签: phpsymfonyfullcalendarbundle

解决方案


感谢@Cerad 和@Frankich,我能够让它工作。

我不得不执行

作曲家需要 toiba/fullcalendar-bundle

正确安装它,然后

作曲家安装--no-dev

命令很好地醒来!

非常感谢你。


推荐阅读