You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I just use findDescendants, all the entities are returned properly, however findDescendantsTree returns just the base entity. The query output in the log works fine and returns all the proper entities:
The resulting output is the root entity and nothing more. What am I doing wrong with my entity/treeRepository? Is there any reason why it would refuse to map the tree correctly? I tried renaming the TreeChildren and TreeParent properties in case they're reserved names, but that didn't help either.
This started out as a question, figured out, see below
The text was updated successfully, but these errors were encountered:
Woofenator
changed the title
[Question] findDescendantsTree doesn't load tree
[Bug] findDescendantsTree doesn't load tree
Jan 23, 2020
Woofenator
changed the title
[Bug] findDescendantsTree doesn't load tree
[Bug] findDescendantsTree doesn't load tree if primary key is not called 'id'
Jan 23, 2020
It assumes that the primary key of the parent entity is called id, so primary keys not named like that (uuid in my case) are not found and the method does not map child onto the parent.
Suggestion: Add option to tell TreeChildren decorator which key to look for. If not provided, assume id, otherwise use provided key, much like the inverse option on Relations
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[x]
mysql
/mariadb
[ ]
oracle
[x]
postgres
[ ]
cockroachdb
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[x]
latest
[x]
@next
[ ]
0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
Quick and simple: TreeRepository is refusing to map my tree for my Closure-Table entity. The entity looks as follows:
and the function that I use to retrieve the tree is as follows:
If I just use
findDescendants
, all the entities are returned properly, howeverfindDescendantsTree
returns just the base entity. The query output in the log works fine and returns all the proper entities:The resulting output is the root entity and nothing more. What am I doing wrong with my entity/treeRepository? Is there any reason why it would refuse to map the tree correctly? I tried renaming theTreeChildren
andTreeParent
properties in case they're reserved names, but that didn't help either.This started out as a question, figured out, see below
The text was updated successfully, but these errors were encountered: