Search This Blog

Loading...

Wednesday, May 6, 2009

Move Symfony Framework Out of Sandbox Application

Symfony Sandbox archive is good for prototyping and evaluation purpose. Although this is not a good practice, but sometimes developers will just hack the Sandbox and turn it into a full fledge web application. And they will regret later when they find that they need to upgrade their Symfony core engines because all the Symfony core files are mixing together with the web app files and there is no way to know which files are Symfony files and which are generated files and which are application-specific files.

I ran into the same problem myself. Initially I was just thinking about playing with Symfony. So I got the Sandbox version and played with it. Little did I realize that the toy application gradually turned into a full web application. And I realized that Symfony has been upgrading the framework at a frantic pace. Not wanting to miss all the new features and bug fixes, I had to do some restructuring to keep the Symfony framework out from my core application.

Here are the steps that I did:
  1. First, you need to have PEAR package installed. If you are using PHP installer, you need to turn on the PEAR extension during the Installation process. After that, you must install PEAR package manager.
  2. Now, you must install the PEAR Symfony package. The way to do this is to:

    pear channel-discover pear.symfony-project.com
    pear install symfony/symfony
    
  3. You can check the Symfony version by typing in the following command, make sure it's the latest, and that the Symfony file path is correct. In my case it's "C:\Program Files\PHP\PEAR\Symfony"

    symfony -V
    
  4. OK, so now you have the correct Symfony framework setup at the correct place. It's time to delete the Symfony framework inside your sandbox application. To do this, delete the following folders:
    1. Sandbox_App/data/Symfony
    2. Sandbox_App/doc/Symfony
    3. Sandbox_Ap/lib/Symfony
  5. Now, go to Sanbox_App/config/ProjectConfiguration.class.php, rename

    require_once dirname(__FILE__).'/../lib/symfony/autoload/sfCoreAutoload.class.php';
    
    to


    require_once 'C:\Program Files\PHP\PEAR\symfony\autoload\sfCoreAutoload.class.php';
    
  6. cd to the Sandbox_App directory, rebuild the model, forms, fitlers, and clear the cache using the following command:

    $ php symfony propel:build-model
    php symfony propel:build-forms
    php symfony propel:build-filters
    php symfony cache:clear
    
That's it! You have successfully move Symfony framework out of Sandbox Application!

No comments: