Symfony Resources Central

Web development made simple

Testing Symfony 1.1

Wondering what symfony 1.1 will look like? Well, I couldn't hold my curiosity neither, so I upgraded one of my websites to symfony 1.1, and I describe here how to setup a box to run both versions. The upgrade process being definitive for a given project, make backups or svn commit before upgrading.

WARNING: Symfony 1.1 is a development version, and should not be used for production. Use it at your own risks.

First of all, i did not want the upgrade to be definitive, I needed a simple way to go back to older version. But SVN would handle this, no problem. On an other side, I needed to keep the two symfony version running on the same box, as other sites are running on it.

My approach to it was to checkout the symfony trunk/lib and trunk/data in /usr/share/pear/symfony1.1 and /usr/share/pear/data/symfony1.1 respectively. This way, i can switch any project I want to symfony 1.1 by changing the config/config.php to use the development version paths.

cd /usr/share/pear/
svn co http://svn.symfony-project.com/trunk/lib symfony1.1
svn co http://svn.symfony-project.com/trunk/data data/symfony1.1

That should retrieve a local copy of the latest development version on your computer.

Upgrading a 1.0 project

To upgrade a project, your first need is to tell the symfony batch script where to find its libraries. Hopefully, symfony's structure permits to set per-project library paths by changing config/config.php. Edit this file and replace the file content by the new 1.1 paths

// symfony directories
$sf_symfony_lib_dir  = '/usr/share/pear/symfony1.1';
$sf_symfony_data_dir = '/usr/share/pear/data/symfony1.1';

You can test your changes were effective by typing symfony in your project directory. You should now see the new namespaced pake tasks that come with symfony 1.1. As in every version, an upgrade pake task that automates the changes you have to make to your project to make it work with the new version is given, and you can do:

symfony project:upgrade1.1
symfony cache:clear

(Note that old symfony cc alias still exists for the cache:clear task)

At this point, I tryed to see if my project would be working, but a nice uncaught LogicException was showing up in development environment, and I had to manually change %project_dir%/apps/*/config/config.php (look at spl_autoload_register line...).

After a little investigation, i found that running the task twice would autocorrect it, and that it was a little problem in lib/task/project/upgrade1.1/sfAutoloadingUpgrade.class.php, so i sent a ticket on Symfony's TRAC.

Now you should have your project up and running.

Generating a new 1.1 project

That's easier than upgrading, but the only (little) difficulty comes from the fact that 'symfony' script will look for 1.0 libraries. For this, you'll create a copy of /usr/bin/symfony to /usr/bin/symfony1.1 (you'll need to be root for this), and change its content to:

#!/usr/bin/env php
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */


// project exists?
if (file_exists('config/config.php'))
{
  include('config/config.php');
}

if (!isset($sf_symfony_lib_dir))
{
  if (is_readable(dirname(__FILE__).'/../../lib/VERSION'))
  {
    // SVN
    $sf_symfony_lib_dir  = realpath(dirname(__FILE__).'/../../lib');
    $sf_symfony_data_dir = realpath(dirname(__FILE__).'/..');
  }
  else
  {
    // PEAR
    $sf_symfony_lib_dir  = '/usr/share/pear/symfony1.1';
    $sf_symfony_data_dir = '/usr/share/pear/data/symfony1.1';

    if (!is_dir($sf_symfony_lib_dir))
    {
      throw new Exception('Unable to find symfony libraries');
    }
  }
}

include($sf_symfony_data_dir.'/bin/symfony.php');

You can now run

symfony1.1 generate:project

in a new directory to have a 1.1 project skeleton built there.

Have fun with it, I'll post articles about the new form/validation system and upgrading your doctrine schemas to the rewritten sfDoctrinePlugin (that works both in 1.0 and 1.1) soon.

 

Share it!

Del.icio.us Digg Furl Fuzz Stumble Upon Yahoo MyWeb 

Comments

1. On Monday, October 29 2007, 10:55 by Christoph

thanks for sharing this one!

2. On Thursday, November 22 2007, 20:00 by Celso

i did all this steps but can't install plugins.

i am getting this

Unable to register channel "plugins.symfony-project.org"

3. On Tuesday, December 4 2007, 17:51 by christian

hey thanks for your post!

I have put up some more infos on setting up symfony 1.1 and the latest sfDoctrinePlugin version here:
http://prototyp.ical.ly/index.php/2...

cheers
/christian

4. On Wednesday, February 27 2008, 04:42 by kisyrua

when I run comand symfony init-project mysymfony in D:\Appserv\www\mysymfony>init-project mysymfony in cmd.exe
warning: include/path/to/symfony/data//bin/symfony.php>: failed to open strem: Nosuch file or directory in D:\Appserv\php5\pear'> in D:\Appserv\www\mysymfony\symfony online 14
Warning: include<>:Failed opening '/path/to/symfony/data//bin/symfony.php'for inclusion <include_path='.;D\Appserv\php5\pear'> in D:\Appserv\www\mysymfony\symfony online 14
Help me fix this Failed

5. On Wednesday, March 5 2008, 08:48 by hartym

well, imho it looks very much like you have a "include/path/to/symfony" somewhere. Maybe you did not install it the right way, you can try to grep the code for this path and replace it by the real include-path-to-symfony. Oh I forgot... maybe you don't have the grep tool :D

Add a comment

HTML code is displayed as text and web addresses are automatically converted.

This post's comments feed

© Copyright 2007-2008 daKrazy. All rights reserved.

Design and template by hartym