Reputation: 562
I'm trying to create a query with propel that joins a first table called Entry with a second table called Company that have 3 fields related to a third table called User.
Entry
Company
User
I want to be able to join Entry to Company by company_id and then join to the table User using the field userid1.
I tried different ways like
EntryQuery::create()->joinWith('Company')->joinWith("User")
but I get and error saying that Entry has no relation with user
or
EntryQuery::create()->useCompanyQuery()->joinWith("User")->endUse()
but I still get an error that Company has no relation with User, even though all the user fields in Company have a relation with User in the database.
There is any way to specify the field on the join?
Upvotes: 1
Views: 521
Reputation: 562
I finally found a way to do it, I'm not sure if it's the best one but works.
EntryQuery::create()
->useCompanyQuery()
->innerJoinUserRelatedByUserId1()
->endUse()
->with("Company")
->with("UserRelatedByUserId1")
This hydrates all the relations.
Upvotes: 1