Symfony2 - PHP致命错误类未找到

时间:2017-07-31 16:14:59

标签: composer-php bundle symfony-2.7

我的symfony2项目有一种奇怪的行为。几天前,我试图添加一个失败的自定义表单监听器,因为symfony没有找到命名空间。 < - 仅供参考

我没有处理这个错误,因为我还有其他一些事情要做。现在,我想在我的注册表单中添加VAT-Validator,我正在使用

composer require ddeboer/vatin-bundle

将此捆绑包添加到我的项目中。它在我的开发环境中工作得很好。然后,当我想用​​git在我的staging-webserver上更新我的项目时,用

清除缓存
php app/console cache:clear --env=prod

我收到此消息:

PHP Fatal error:  Class 'Ddeboer\VatinBundle\DdeboerVatinBundle' not found in ../app/AppKernel.php on line 24

我也尝试过其他捆绑包。但它与每个“新”捆绑包的错误相同。因为,我几天前就遇到了命名空间问题,我想自动加载有问题。

已经尝试过在google和stackoverflow上找到的各种解决方案。 在文档中,有一个提示:

  

如果在此步骤中遇到“找不到类”错误,则可能需要在运行此命令之前运行export SYMFONY_ENV=prod,以便post-install-cmd脚本在prod环境中运行。

我正在使用Windows,此命令无效。此外,在我的ubuntu服务器上,我可以使用此命令,但似乎没有效果。

这是我的composer.json:

{
"name": "Admin/myproject",
"license": "proprietary",
"type": "project",
"autoload": {
    "psr-0": {
        "": "src/",
        "SymfonyStandard": "app/"
    }
},
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "~2.2,>=2.2.3,<2.5",
    "doctrine/dbal": "<2.5",
    "doctrine/doctrine-bundle": "~1.2",
    "twig/extensions": "~1.0",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~3.0,>=3.0.12",
    "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/elastica-bundle": "^3.2",
    "elasticsearch/elasticsearch": "~1.0",
    "cocur/slugify": "^2.0",
    "ddeboer/vatin-bundle": "^2.0"
},
"require-dev": {
    "sensio/generator-bundle": "~2.3",
    "phpdocumentor/phpdocumentor": "~2.2"
},
"scripts": {
    "post-root-package-install": [
        "SymfonyStandard\\Composer::hookRootPackageInstall"
    ],
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ]
},
"config": {
    "bin-dir": "bin"
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    }
}

}

0 个答案:

没有答案