2016-11-16 97 views
1

我想升級我的Symfony 2.7到Symfony 3.0或3.1。 我在我的項目中使用了propel,propel-bundle。 我讀了很多關於Symfony升級步驟的頁面。通過作曲家來完成。 在fisrt我升級了我的作曲家。 更改compser.json文件內容:升級Symfony 2.7到3.0(3.1)與推進捆綁

{ 
    "name": "symfony/framework-standard-edition", 
    "license": "MIT", 
    "type": "project", 
    "description": "The \"Symfony Standard Edition\" distribution", 
    "autoload": { 
     "psr-4": { 
      "": "src/", 
      "SymfonyStandard\\": "app/SymfonyStandard/" 
     }, 
     "files": [ "vendor/propel/propel-bundle/PropelBundle.php" ] 
    }, 
    "require": { 
     "symfony/symfony": "3.1.*", 
     "php": ">=5.6.11", 
     "doctrine/orm": "^2.5", 
     "doctrine/doctrine-bundle": "^1.6", 
     "symfony/swiftmailer-bundle": "^2.3", 
     "symfony/monolog-bundle": "^2.8", 
     "sensio/distribution-bundle": "^5.0", 
     "sensio/framework-extra-bundle": "^3.0.2", 
     "sensio/generator-bundle": "^3.0", 
     "incenteev/composer-parameter-handler": "^2.0", 

     "twig/extensions": "1.4.*,>=1.4", 
     "symfony/assetic-bundle": "2.8.*,>=2.8", 
     "propel/propel": "2.0.0-alpha6", 
     "propel/propel-bundle": " 3.0.x-dev", 
     "phpunit/phpunit": "5.6.*,>=5.6", 
     "liuggio/excelbundle": "2.1.*,>=2.1" 
    }, 
    "scripts": { 
     "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": [ 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" 
     ] 
    },  
    "config": { 
     "bin-dir": "bin" 
    }, 
    "extra": { 
     "symfony-app-dir": "app", 
     "symfony-bin-dir": "bin", 
     "symfony-var-dir": "var",  
     "symfony-web-dir": "web", 
     "symfony-assets-install": "relative", 
     "incenteev-parameters": { 
      "file": "app/config/parameters.yml" 
     }, 
     "branch-alias": { 
      "dev-master": "3.0-dev" 
     } 
    } 
} 

...我得到了升級的過程,推動/ proepl束/未找到PropelBundle()類然而路徑是正確的結束。

有沒有人有任何經驗...或任何意見? 我試圖發現至極propelBundle版本可能是正確的...

感謝

+1

KNPLabs提供了一個非常好的演練http://knpuniversity.com/screencast/symfony3-upgrade 雖然您可能沒有訂閱,但他們仍然可以在視頻下方的文本中提供所有視頻。 – pavlovich

+0

Thaks pavlovich!我立即檢查! – aBanhidy

+1

我所做的是安裝一個新的Symfony 3x項目,然後使用作曲家添加第三方的東西。大多數情況下會導致正確的依賴關係被加載。然後,我將舊版代碼合併到新項目中,或將composer.json複製到舊項目中,刪除供應商,然後重新安裝。 – Cerad

回答

0

最後的解決方案是/是:你可以從這裏下載PropelBundle源代碼: https://github.com/propelorm/PropelBundle

...但是在這個頁面上,作者爲Symfony2編寫了這個Bundle,它與Symfony 3.0或3.1一起使用。 我做了什麼:將源代碼下載到我的電腦上。進入Symfony/vendor/propel/propel/src/Propel文件夾。創建一個新文件夾:Bundle並在此複製下載的PropelBundle文件夾。 當然之前我與作曲家安裝Propel2:

"propel/propel": "[email protected]" 

後,只有我做了什麼:編輯AppKernel.php:

public function registerBundles() { 
     $bundles = array(
      ... 
      new Propel\Bundle\PropelBundle\PropelBundle(), 
      ... 
     ); 

     if (in_array($this->getEnvironment(), array('dev', 'test'))) { 
      ... 
     } 

     return $bundles; 
    } 

添加新propel.yml配置文件,並將其包含到應用程序/ config/config.yml文件。

...終於有效! 我會看到這是一個很好的解決方案。目前看起來像:IT WORKS FINE!

最後但最不重要:我想說,非常感謝那些爲我的第一條評論添加評論的人。