First of all thanks everyone contributing to this awesome library.
I am having trouble joining nested relations, below is my use case

Any help would be appriciated
Thanks,
Dinesh
Hi, have you tried to add aliases in every join option?
I just tried with this setup

With this I am not getting the error, but I am not getting the profile object anywhere
that means that you have something wrong with defining relations in entities
I will share the relations
Post Entity

Comment Entity


I looked into the code a bit and found that, on using alias the relationMetadata is not found due to which the join is not happening

Please ignore the joinOptions argument in the getRelationMetadata method, thats something i was started playing around in order to dig into the issue
I logged the query, and noticed that an alias for column has been assigned to every other column except the profileId columns

Could you please confirm that you've added profileId as a column to every entity that has profile relation? If not, I think you should add it
Only user entity has a Profile relation.
I have the join column decorator on the relation so adding the profileId column throw DUP_KEY error while running
I tried removing the JoinColumn and adding a profileId column as well like below with no luck still the same error dup_fieldname

Ok I think I got it working finally 馃槍
Here is the summary of the whole thing
Select statement in the setJoin cases the relation to be included

As seen below
So i wrote a very hacky code to exclude the nested selects after the complete query has been built from createBuilder method

nest I also noticed getRelationMetaData method was not including the nested relations which are aliased, so again here is the quick hacky code i wrote to make it work

I tested this with against my usecase with alias's for now.
I some once can share their thoughts on the approach and if its on the right track then I will start writting some test cases and open a PR for the same.
Thanks,
Why don't you use required: false for left join relations?
sorry didnt get you, can you elaborate
Is there any update about this? It seems that joining previously aliased related entities is not working at all.
that means that you have something wrong with defining relations in entities
Or you cannot join aliased relations by the documentation:
Each key of join object must strongly match the name of the corresponding resource relation. If particular relation name is not present in this option, then user will not be able to get this relational objects in GET request.
fixed in v4.6.0
Thanks a lot, saved the day