Model Relationship #722

Closed
gmercey opened this Issue Dec 11, 2012 · 5 comments

Comments

Projects
None yet
3 participants

gmercey commented Dec 11, 2012

Hello,

I have a problem with relationship between models: when I use "with" in a "find" request, only the first model of the "with" array is loaded.

ex: Internship::find('all', array( 'with' => 'students','professors','tutors));

The sql request return is SELECT * FROM interneship LEFT JOIN students WHERE internship.student_id = student.id

This works with a previous release few days ago.

Contributor

jails commented Dec 11, 2012

Seems the correct syntax is:

Internship::find('all', array( 'with' => array('Student','Professor','Tutor')));

'with' should be an array of relation names.

Contributor

jails commented Dec 11, 2012

Sorry, you're right. #723 should solve my mistake.

Owner

nateabele commented Dec 11, 2012

Fixed by #723. Thanks @jails!

nateabele closed this Dec 11, 2012

gmercey commented Dec 11, 2012

Works perfectly ! Thanks

Owner

nateabele commented Dec 11, 2012

Awesome. :-) Let us know if the docs aren't clear on the correct configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment