[Dbix-class] Generating DISTINCT ON with sub query
Peter Rabbitson
rabbit+dbic at rabbit.us
Wed Apr 3 15:55:43 GMT 2013
On Wed, Apr 03, 2013 at 08:41:05AM -0700, Rippl, Steve wrote:
> Have I given you enough info?
I think so but I want to make sure I got it right. Tell me if the thing
below is correct:
$course_section_rs->search({}, {
join => [
{ 'course' => [ <------------------- me -> belongs_to(course)
{ course_coursetypes => 'type' }, <-- me -> belongs_to(course) -> has_many(course_coursetypes) -> belongs_to(type)
{ course_grades => 'grade' }, <------- me -> belongs_to(course) -> has_many(course_grades) -> belongs_to(grade)
'course_locations', <---------------- me -> has_many(course_locations) (this one is not referenced anywhere - mistake?)
] },
{ 'section' => { 'section_staffs' => 'staff' } } me -> belongs_to(section) -> has_many(section_staffs) -> belongs_to(staff)
]})
If this is true (specifically the has_many(section_staffs) part) then this:
> Each Section only has one teacher and belongs to one course
can't be correct...
Please clarify ;)
More information about the DBIx-Class
mailing list