Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple levels of relations #91

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

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