Joins
You can use custom joins to narrow down which records are returned, even for relationships that are not defined in your mapping definitions.
The query builder can also be used to specify custom joins with aliases that can be used in the criteria. Normally, joins are handled automatically based on the relationships you define between your entities, however, sometimes you will want to limit the records that are returned by adding a custom join (perhaps back to the same entity), and specifying criteria based on any joined records. To do this, just call the leftJoin
or innerJoin
method on the query builder like this:
The above would be translated into SQL such as this:
Last updated