Blog

Doctrine gains symfony citizenship in 1.2

Symfony Live 2010 Paris Conference

« Back to the Blog

Categories

Feeds

feed Posts feed

comments feed Comments feed

symfony training
Be trained by symfony experts
Feb 15: Paris (What's new in 1.3 / 1.4 - English)
Feb 15: Paris (and Zend Framework Together - English)
Feb 15: Paris (Hosting Practices with symfony - English)
Feb 24: Paris (1.4 + Doctrine - Français)
Mar 04: Online (What's new in 1.3/1.4 - Français)
and more...

Archives

Creative Commons License This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.

Today, Doctrine gained its citizenship in symfony 1.2. The sfDoctrinePlugin was linked via externals and is now officially bundled with symfony. If you've been around for a while, you'll know that this was highly anticipated and is a long time coming. To celebrate, I'll give a short little tutorial on how you can get started using Doctrine in symfony. Read below if you're interested.

Getting Started

Update config/databases.yml

all:
  doctrine:
    class:          sfDoctrineDatabase
    param:
      dsn:          mysql://root@localhost/dbname

Create config/doctrine/user.yml

---
User:
  columns:
    username: string(255)
    password: string(255)

Create data/fixtures/user.yml

---
User:
  User_1:
    username: jwage
    password: changeme

Create application

./symfony generate:app frontend

Build everything

./symfony doctrine:build-all-reload frontend

Inspect database with DQL Query

./symfony doctrine:dql frontend "FROM User u"
>> doctrine  executing: "FROM User u" ()
>> doctrine    id: '1'
>> doctrine    username: jwage
>> doctrine    password: changeme

Your data fixtures are loaded and your User model is ready to be used in your application. Couldn't be any easier!

What is to come?

  1. Official Documentation. symfony + Doctrine book.
  2. New features
  3. Doctrine training sessions by sensio

Thanks to everyone who adopted Doctrine early and stood by the project through thick and thin. Without your dedication this would not be possible today. So, a big thanks goes out to the community.

Comments comments feed

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.