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

tree entity recursive select? #4564

Closed
ThisIsHG opened this issue Aug 9, 2019 · 4 comments
Closed

tree entity recursive select? #4564

ThisIsHG opened this issue Aug 9, 2019 · 4 comments

Comments

@ThisIsHG
Copy link

ThisIsHG commented Aug 9, 2019

Issue type:

[X] question
[ ] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[X] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[X] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Is it possible to select all entity's, laying underneath a specified tree component?

For example I've got an Entity "Category" like in the example of Tree Entities and "Posts" which can have a Category as a One to Many relation.

Can I build a query that returns all posts of all categorys underneath a specified one? And if so how?

@arminghm
Copy link

I think you can use relations, take a look at https://github.com/typeorm/typeorm/blob/master/docs/find-options.md#basic-options

@zecka
Copy link

zecka commented Jun 1, 2020

@ThisIsHG do you find the solution with "relations" ?
I don't find how to build this query.

@TheProgrammer21
Copy link
Contributor

I just implemented a pull request to satisfy your needs!

pleerock pushed a commit that referenced this issue Aug 4, 2021
* feat: add relation option to tree queries

Add possibility to load relations of tree entities

Closes: #7974 #4564

* style: remove unused declaration

remove unused declaration to satisfy linting.

* Update tree-entities.md

docs: rename variable for copy paste

* Update FindOptionsUtils.ts

style: remove prettified code

* style: remove prettified code

* style: remove prettified code

* test: enable test for all drivers
@imnotjames
Copy link
Contributor

imnotjames commented Aug 13, 2021

This has been merged and released. Closing out this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants