symfony1 icon indicating copy to clipboard operation
symfony1 copied to clipboard

How to upgrade from 1.4.16

Open ceochronos opened this issue 3 years ago • 5 comments

Can you give me a general idea about how to start upgrading my app?

The app is actively used with dozens of models and modules.

Is it possible to upgrade directly to 1.5.13 or Do I have to upgrade release by release?

I'm using Symfony 1.4.16 with propel

ceochronos avatar Oct 19 '21 20:10 ceochronos

This is what I have on my notes for the last project I upgraded, this was a Doctrine project but it may help you.

At the project root folder:

composer require friendsofsymfony1/symfony1
composer require friendsofsymfony1/doctrine1

To use a different path than vendor add vendo-dir to your composer.json config:

$ cat composer.json 

 {
    "require": {
        "friendsofsymfony1/symfony1": "1.5.*",
        "friendsofsymfony1/doctrine1": "1.3.*"
    },
    "config": {
        "vendor-dir": "lib/vendor/symfony1.5"
    }
 }

Replace the old autoload class with the one generated by composer:

cat config/ProjectConfiguration.class.php
 <?php
 //require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
 require_once __DIR__.'/../lib/vendor/symfony1.5/autoload.php’;

Grep the code to search for Doctrine:: occurrences:

grep -R 'Doctrine:' .

Replace all Doctrine instances with Doctrine_Core. For example in:

plugins/sfDoctrineGuardPlugin

Fix method declaration warnings in models, for example:

// lib/model/doctrine/Position.class.php
class Position extends BasePosition
{
    - public function preInsert()
    + public function preInsert($event)
    {
        $this->setOwnerId($this->getCreatedBy());
    }

gigo6000 avatar Oct 19 '21 20:10 gigo6000

thanks, a good starting point. The composer tip will be useful

ceochronos avatar Oct 20 '21 05:10 ceochronos

If anyone's interested, we at @prezly maintain our own fork of symfony1, which has been moved forward from 1.4

It's https://github.com/rock-symphony/rock-symphony

e1himself avatar Oct 20 '21 11:10 e1himself

Hello there,

@gigo6000 Your upgrade steps are good.

In order to have one shared reference for upgrade steps. I invite you to create a pull request with them on UPGRADE.md file.


Just one feedback.

Replace all Doctrine instances with Doctrine_Core.

Another solution is just to create the proxy class.

class Doctrine extends Doctrine_Core
{
}

It seems a hack, but it limits the number of changes and therefore the number of potential errors.

alquerci avatar Oct 21 '21 11:10 alquerci

@alquerci yeah that seems like a more elegant solution I may try that next time, thanks.

This are not really steps but more like my notes but when I have a chance I will organize them better and create a PR. I've upgraded about 3 projects so far so I may have more notes somewhere.

gigo6000 avatar Oct 21 '21 16:10 gigo6000