Skip to content

Conversation

@DeanMauro
Copy link
Collaborator

@DeanMauro DeanMauro commented Jan 27, 2022

This PR adds filter support for n levels of relations (e.g. person.neighbor.pet.name:eq "fido") to fix #17 and #79.

In order to do so, subqueries have been replaced with joins. The first step the FindQueryBuilder performs joins all related tables and adds aliases on each. Then, the filter queries are built using these aliases.

The PropertyRef class has been updated as well:

  • The relation property is now relations in order to hold multiple levels or relational fields.
  • There is now a modelClasses property to hold the models represented by a query (using the example above: [Person, Person, Animal]).

DeanMauro and others added 10 commits March 16, 2021 23:21
`buildFilter()` aliases relations that are not OneToOne, but `fullColumnName()` does not, the result being that filters on fields nested in HasMany or ManyToMany relations fail.
This commit makes the `fullColumnName()` method alias all such relations.
There are 3 cases to consider rather than 2:
1. Is not a relation
2. Is a relation and !isOneToOne
3. Is a relation and isOneToOne
Objection Find is now supports multiple levels of depth.
Subqueries replaced with joins during the process.
DanAlexandruNiculescu and others added 4 commits July 26, 2022 13:31
- GroupBy key column added as a default
- GroupBy parameter is added only if there are joins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Only one level of relations is supported

2 participants