I read through lithium\data\model\query, but I didn’t see any examples of joins.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are multiple ways to perform a join with Lithium.
join()method (see theAPI)).joins.Connection->read().The other methods are reasonably well documented, so I’ll give an example of passing Query objects to a finder.
The
sourceis the table that you want to join andconstraintis the join criteria. Lithium aliases the find table to the name of the model, so use that in your constraint. You can then pass the joins in to any finder along with any other parameters you want.Note that at the time of writing, joins (and relationships) will only work with a relational database, not for things like MongoDB’s DBRef.
Update: Removed links that have been link jacked.