简体   繁体   English

Symfony 2.3:更新供应商和清除缓存时找不到CollectionRegionDoctrineCommand

[英]Symfony 2.3: CollectionRegionDoctrineCommand not found when update vendors and clear cache

Everything worked fine until I actualize the vendors. 一切正常,直到我实现供应商。

Then when I clean the cache I get the following error: 然后,当我清理缓存时,我收到以下错误:

PHP Fatal error: Class 'Doctrine\\ORM\\Tools\\Console\\Command\\ClearCache\\CollectionRegionCommand' not found in /var/app/ondeck/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Command/Proxy/CollectionRegionDoctrineCommand.php on line 29 PHP致命错误:在/ var / app / ondeck / vendor / doctrine / doctrine-bundle / Doctrine / Bundle / DoctrineBundle / Command / Proxy / CollectionRegionDoctrineCommand中找不到 'Doctrine \\ ORM \\ Tools \\ Console \\ Command \\ ClearCache \\ CollectionRegionCommand'。第29行的PHP

I was also having the same issue but with Symfony 2.4 with the following inside my composer.json file: 我也有同样的问题,但在我的composer.json文件中使用Symfony 2.4以下内容:

    "symfony/symfony": "~2.4",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "~1.2",
    "doctrine/doctrine-migrations-bundle" : "dev-master",
    "doctrine/doctrine-fixtures-bundle" : "dev-master",

I had version 2.4.1 of Doctrine ORM installed which if you look on Github here : 我安装了Doctrine ORM版本2.4.1,如果你在这里查看Github:

You can that the file mentioned is not present (no sure why). 你可以说上面提到的文件不存在(不确定原因)。 But it is present on the 'master' branch here . 但它出现在这里的'主'分支上。 Not sure if you will be able to change to using master for Doctrine ORM based on other dependencies, but it was ok for me to switch to 'master' like so: 不确定你是否能够根据其他依赖关系改为使用master for Doctrine ORM,但我可以像这样切换到'master':

    "symfony/symfony": "~2.4",
    "doctrine/orm": "dev-master",
    "doctrine/doctrine-bundle": "~1.2",
    "doctrine/doctrine-migrations-bundle" : "dev-master",
    "doctrine/doctrine-fixtures-bundle" : "dev-master",

And then run: ./composer.phar update doctrine/orm 然后运行:./composer.phar update doctrine / orm

A best practice with composer is never do an update without specify the name of the dependency you want to update. 使用composer的最佳实践是在不指定要更新的依赖项的名称的情况下永远不会进行更新。

For example in symfony2, if you have a working version: Instead of doing 例如在symfony2中,如果你有一个工作版本:而不是做

php composer.phar update

do

php composer.phar update [name of the vendor]

In other case: if you clone an existing project and you want install vendors localy, do 在其他情况下:如果您克隆现有项目并且您希望安装供应商localy,请执行

php comoser.phar install

Never update vendors globaly. 永远不要更新供应商全球。

ok modify your composer.json and set : 确定你的composer.json并设置:

    "doctrine/orm": "~2.2,>=2.2.3",

It works for us. 它对我们有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM