2014-03-13 72 views
2

我有我的所有網址的網站這個回報symfony的錯誤:
ClassNotFoundException的:試圖加載類‘在C’從命名空間‘學說\包\ FixturesBundle’DoctrineFixturesBundle:\開發\ Apache2.4.6 \ htdocs中\ mysite的\程序\ AppKernel.php線23.你需要從另一個命名爲「用」嗎?
ClassNotFoundException的:試圖加載類「DoctrineFixturesBundle」

當我修改config.yml此錯誤出現(部分學說orm)解決別人的問題,但不能解決。事實上,我在這個文件中更改並重新運行我的網站,但現在無法正常運行。我隨時隨地都有這個錯誤。

複製我的代碼在這裏,但在簡單的問題回答:
- 你已經在AppKernel.php加入這一行:$束[] =新學說\包\ FixturesBundle \ DoctrineFixturesBundle(); ? 迴應:是的
- 你有安裝夾具捆綁?迴應:是的
- 你有安裝/更新和自更新作曲家嗎?回覆:是
- 您是否有裝入數據庫的裝置?迴應:是(它完美運行)
- 你有清理緩存嗎?回覆:是的

所有我的燈具引擎運行正確之前,這就產生錯誤。

AppKernel.php

 if (in_array($this->getEnvironment(), array('dev', 'test'))) { 
     $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); 
     $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 
     $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 
     $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 
    } 

composer.json

"require": { 
    "php": ">=5.3.3", 
    "symfony/symfony": "~2.4", 
    "doctrine/orm": "2.4.2", 
    "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": "~2.3", 
    "sensio/framework-extra-bundle": "~3.0", 
    "sensio/generator-bundle": "~2.3", 
    "incenteev/composer-parameter-handler": "~2.0", 
    "doctrine/doctrine-fixtures-bundle": "dev-master" 
}, 

config.yml

doctrine: 
dbal: 
    driver: "%database_driver%" 
    host:  "%database_host%" 
    port:  "%database_port%" 
    dbname: "%database_name%" 
    user:  "%database_user%" 
    password: "%database_password%" 
    charset: UTF8 
    # if using pdo_sqlite as your database driver, add the path in parameters.yml 
    # e.g. database_path: "%kernel.root_dir%/data/data.db3" 
    # path:  "%database_path%" 

orm: 
    auto_generate_proxy_classes: "%kernel.debug%" 
    auto_mapping: true 

感謝您的寶貴幫助

回答

2

很奇怪的現象,因爲我t的自動解決和單獨解決。 經過多次緩存:清除,手動刪除緩存,在AppKernel.php中註釋/分解行這個問題解決。

而是一個新的開始......

現在,這是我的開發工具欄的symfony不運行。

我想爲這個新問題創建一個新主題,不要混淆這個。

+0

我也是,我有這個問題,我認爲這是由從windows複製/ psting代碼到unix平臺(如Ubuntu)造成的。對於我來說,每一次,我從Windows複製代碼到unix,我得到這個錯誤。 – skonsoft

+1

我不知道你的評論是否詳細描述了我的實際問題的原因,但是我已經在你說的同一時間用linux和windows查看工作中的錯誤。 – darkomen

1

I'he得到了同樣的錯誤怪異的

new Application\Extended\SonataMediaBundle\ExtendedSonataMediaBundle() 

在我的情況又回到了工作後,我固定composer.json文件,並拼命地跑作曲家更新。爲了正確,我第一次發起沒有作曲家的「作曲家更新」。json修復和錯誤沒有消失,所以「作曲家更新」本身並不是解決方案,關鍵是 - composer.json文件修復。

這更奇怪的,因爲它是修復 - 我在PSR-0自動加載定義中刪除斜線,所以有:

"autoload": { 
    "psr-0": { "/": "src/" } 
}, 

我得到:

"autoload": { 
    "psr-0": { "": "src/" } 
}, 

那只有一個斜槓! 它是錯誤的,因爲修復作曲家建議不要使用空命名空間

$ composer validate 
./composer.json is valid, but with a few warnings 
See https://getcomposer.org/doc/04-schema.md for details on the schema 
Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance 

注1:它與斜線曾在以前的日子和採空今天的工作,非常奇怪。項目在兩個工作狀態之間沒有受到任何影響!注意2:composer.json文件的初始(in-box)狀態沒有斜線,兩週前我添加了它來抑制作曲家的不滿。

+0

我不知道你的回覆是否解決了我的問題,但我認爲這是有用的和有興趣的回覆。感謝您的答覆。 – darkomen

相關問題