Chapter 3. Associations

In the previous chapter, we learned how to use Doctrine annotations to add mapping information to an entity class. We used code and database schema generators provided by Doctrine command-line tools, and we created a minimalist blog software that uses an EntityManager class to create, update, delete, and display blog posts.

In the third chapter, we will learn how to handle associations between entities through the following topics:

  • Getting started with the Doctrine associations
  • Understanding the @ManyToOne and @OneToMany annotations with the comment system
  • Understanding the @ManyToMany annotation with tags

Getting started with the Doctrine associations

We will specify Doctrine associations, such as other mapping information, ...

Get Persistence in PHP with Doctrine ORM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.