Backend and Infrastructure

Databases and Doctrine

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Sprout Video

Symfony doesn’t care about your database or the code you use to talk to it. Most people that use Symfony use a third-party database library called Doctrine. Doctrine maps rows and columns in your database to objects and properties in PHP. Imagine we have an Event object with name and location properties. If we tell Doctrine to save this object, it inserts a row into a table and puts the data on name and location columns. And when we query for the event, it puts the column data back onto the properties of an Event object. When using Doctrine you need to stop thinking about tables, and start thinking about PHP classes. In this lesson, you will create the Event Entity Class, and learn a little debugging trick.

Additional resources

Doctrine website