Chapter 4. Building Queries

In the previous chapter, we added commenting and tagging support to our blog software. Although it works fine, some of the features can be enhanced.

In this chapter, we will leverage some very important parts of Doctrine: Doctrine Query Language (DQL), entity repositories, and the Query Builder. We will cover the following aspects in this chapter:

  • Optimizing the Comment feature
  • Creating a page to filter the posts with the help of tags
  • Displaying the number of comments of a post on the home page

Understanding DQL

DQL is the acronym of Doctrine Query Language. It's a domain-specific language that is very similar to SQL, but is not SQL. Instead of querying the database tables and rows, DQL is designed to query the object model's ...

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.