【问题标题】:Upgrade Symfony 2.7 to 3.0 (3.1) with propel bundle使用推进包将 Symfony 2.7 升级到 3.0 (3.1)
【发布时间】:2020-08-10 13:27:08
【问题描述】:

我正在尝试将我的 Symfony 2.7 升级到 Symfony 3.0 或 3.1。我在我的项目中使用推进,推进捆绑。我阅读了很多关于 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 版本可能是正确的。

【问题讨论】:

  • KNPLabs knpuniversity.com/screencast/symfony3-upgrade 提供了一个非常好的演练,虽然您可能没有订阅,但他们仍然在视频下方提供所有截屏视频。
  • 谢谢帕夫洛维奇!我马上检查!
  • 我所做的是安装一个全新的 Symfony 3x 项目,然后使用 composer 添加 3rd 方的东西。大多数情况下,这会导致加载正确的依赖项。然后我要么将旧代码合并到新项目中,要么将 composer.json 复制到旧项目中,删除供应商,然后重新安装。
  • 感谢塞拉德!另一个好主意!实际上,我正在准备 pavlovich 提到的页面。这真的很好,真的很有帮助!
  • 巴甫洛维奇!您推荐的页面非常棒!我学到了很多......但不幸的是我没有找到解决方案。实际上,正如我所见,Symfony 3 不支持 Propel 包……但是我在 Propel 或 Symfony 网页上没有找到任何有关它的信息……所以问题更进一步:Symfony 3 是否支持 Propel 包?

标签: php symfony propel


【解决方案1】:

最后正确的解决方案是/曾经是:您可以从这里下载 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 文件中。

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-30
    • 2022-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多