php - Propel 2 double join on custom field -
i'm trying create query propel joins first table called entry second table called company have 3 fields related third table called user.
entry
- id
- field1
- field2
- company_id
company
- id
- field1
- field2
- user_id1
- user_id2
- user_id3
user
- id
- name
- surname
- team
i want able join entry company company_id , join table user using field userid1.
i tried different ways like
entryquery::create()->joinwith('company')->joinwith("user")
but , error saying entry has no relation user
or
entryquery::create()->usecompanyquery()->joinwith("user")->enduse()
but still error company has no relation user, though user fields in company have relation user in database.
there way specify field on join?
i found way it, i'm not sure if it's best 1 works.
entryquery::create() ->usecompanyquery() ->innerjoinuserrelatedbyuserid1() ->enduse() ->with("company") ->with("userrelatedbyuserid1")
this hydrates relations.
Comments
Post a Comment