Steps for a successful symfony living part 2

You probably read about http://www.ktolis.gr/lang/el/2008/05/15/steps-for-a-successful-symfony-living-part-1/ which is a quick guide on how to get started with propel on symfony back on the days of symfony 1.2. Now Symfony 1.4 is live and doctrine is the *new* kid on the block. We need to see how to get started with this one.. Lets see..

First download the symfony 1.4.x tarball from http://www.symfony-project.org/installation/1_4 I downloaded 1.4.5 for example. Then type in the terminal :

$ tar -zxf symfony-1.4.5.tgz
$ mkdir -p lib/vendor
$ mv symfony-1.4.5 lib/vendor/symfony

This will make the lib/vendor/symfony structure with the contents of the tarball. You can now dispose of the tarball with rm symfony-1.4.5.tgz . Now you can generate a new project like so:

./syfmony generate:project snake

Now create a new placeholder application by typing

./symfony generate:app frontend

We need to type now this command to link to the right graphics too:

ln -s /<absolute.path.to>/lib/vendor/symfony/data/web/sf web/sf

Now configure the database connection by editing the file config/databases.yml:

all:
doctrine:
class: sfDoctrineDatabase
param:
dsn:      mysql:host=db_hostname;dbname=db_title
username: database_user
password: password

Edit your database/model schema at config/doctrine/schema.yml like so:

Link:
columns:
url: { type: string(256), notnull:true }
title: { type: string(256), notnull:true }    title:

and type:

s doctrine:build --all --and-load

to build the database sql, run the sql script, create the model and load the fixtures (if you have any) and thus replace anything that was there already. You are good to go. Enjoy your coffee now. You can code now 🙂