aBanhidy
aBanhidy

Reputation: 291

Upgrade Symfony 2.7 to 3.0 (3.1) with propel bundle

I am trying to upgrade my Symfony 2.7 to Symfony 3.0 or 3.1. I am using propel, propel-bundle in my project. I read a lot of pages about Symfony upgrade steps.

Do it via composer. At first I upgraded my composer.

Change the composer.json file content:

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

...and I got the end of the upgrade process that propel/proepl-bundle/PropelBundle() class not found however the path is right.

Is anybody has any experience with it...or any advise? I am trying to found out which propelBundle version could be right.

Upvotes: 1

Views: 825

Answers (1)

aBanhidy
aBanhidy

Reputation: 291

Finally the right solution is/was: you are able to download the PropelBundle source code from here: https://github.com/propelorm/PropelBundle

...however on this page the author write this Bundle for Symfony2 it is works with Symfony 3.0 or 3.1. What I did: download the source code somewhere onto my computer. Go into Symfony/vendor/propel/propel/src/Propel folder. Create a new folder: Bundle and copy here the downloaded PropelBundle folder. Of course before I installed Propel2 with composer:

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

After only what I did: edit the AppKernel.php:

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

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

        return $bundles;
    }

Add the new propel.yml configuration file and include it into app/config/config.yml file.

...finally it works! I'll see that is a good solution or not. At the moment it looks like: IT WORKS FINE!

Last but least: I would like to say a big thank those Guys who add comment to my first comment.

Upvotes: 1

Related Questions