Doctrine Databasics

Unless you are building a static website, there's a very high likelyhood that you will need to - at the very least - retrieve some information from a database. Saving new or updated data to the database is usually not far behind.

As a PHP web developer, you have likely had this 'problem' before. You may have solved this problem just fine using (hopefully) PDO, (or less preferably) mysqli_*, or some other variation.

Why on Earth then, do you have to learn yet another new technology - Doctrine in this case - just to interact with your database in a Symfony application?

Well, truthfully, you don't. You can continue interacting with your database however you see fit. But investing a little time in learning Doctrine will make your life as a developer that little bit easier.

It will make your life easier by separating the code that does the 'business stuff' in your application, from the code that saves (persist's in Doctrine terminology) data to your database.

Probably the biggest drawback to learning Doctrine, from experience, is the sudden influx of a load of new terms:

  • Persistence
  • Hydration
  • Annotations
  • Fixtures
  • Migrations

And those are just a few.

Fortunately, you don't need to know them all. And honestly, most of them are easier to understand once you have seen the underlying premise in action.

We've already talked about Persistence, but it's a good example of the 'scary' terminology. Rather than thinking about persistence, just think: "saving". There we go, one less scary term to worry about.

The same goes for most, if not all of the terms honestly. Once you've seen them in action, you have some point of reference, and hey-ho, suddenly it all makes sense.

This beginner friendly short course is all about demystifying a bunch of these terms, and getting your started - quickly - with some hands on exercises to cover the basics of working with Doctrine in Symfony 3.


# Title Duration
1 Creating Your Database and First Entity with Doctrine 13:35
2 How to Retrieve Data From The Database 12:26
3 Read, Update, and Delete 10:45
4 Hands On - Scraping Reddit to Explain Entity Relationships 15:14
5 Scraping Reddit Authors 17:18
6 Relating RedditPost with RedditAuthor - OneToMany, ManyToOne 19:09
7 DQL vs Doctrine Query Builder 25:51

Share This Course

If you have found this course helpful, please share it.

Presented by

Christopher Moss

Christopher Moss

Hi, I'm Chris and welcome to In this video you will learn about... :)