繁体   English   中英

使用推进包将 Symfony 2.7 升级到 3.0 (3.1)

[英]Upgrade Symfony 2.7 to 3.0 (3.1) with propel bundle

我正在尝试将我的 Symfony 2.7 升级到 Symfony 3.0 或 3.1。 我在我的项目中使用 propel、propel-bundle。 我阅读了很多关于 Symfony 升级步骤的页面。

通过作曲家来做。 起初我升级了我的作曲家。

更改 composer.json 文件内容:

{
    "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"
        }
    }
}

...我的升级过程结束了,找不到 propel/proepl-bundle/PropelBundle() 类,但是路径是正确的。

有没有人有这方面的经验...或任何建议? 我试图找出哪个 propelBundle 版本可能是正确的。

最后正确的解决方案是:您可以从这里下载 PropelBundle 源代码: https : //github.com/propelorm/PropelBundle

...然而在这个页面上,作者为 Symfony2 编写了这个 Bundle,它适用于 Symfony 3.0 或 3.1。 我做了什么:将源代码下载到我的电脑上。 进入Symfony/vendor/propel/propel/src/Propel文件夹。 创建一个新文件夹: Bundle并将下载的 PropelBundle 文件夹复制到此处。 当然,在我用 composer 安装 Propel2 之前:

"propel/propel": "~2.0@dev"

仅在我所做的之后:编辑 AppKernel.php:

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

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

        return $bundles;
    }

添加新的 propel.yml 配置文件并将其包含到 app/config/config.yml 文件中。

……终于成功了! 我会看看这是否是一个很好的解决方案。 目前它看起来像:它工作正常!

最后但最不重要的是:我要非常感谢那些在我的第一条评论中添加评论的人。

暂无
暂无

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

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