Skip to content

Commit 49183c5

Browse files
committed
Fix broken BelongsToMany through example in associations docs.
Fix invalid valueField 'studentFirstName' to 'first_name' matching actual database column conventions. Fix indentation of find() arguments. Add context comment clarifying where the code runs.
1 parent de32602 commit 49183c5

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

docs/en/orm/associations.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,12 @@ such as a where condition by designating the through table name before the field
727727
you are filtering on:
728728

729729
``` php
730-
$query = $this->find(
731-
'list',
732-
valueField: 'studentFirstName', order: 'students.id',
733-
)
730+
// In a StudentsTable method or controller action.
731+
$query = $this->Students->find(
732+
'list',
733+
valueField: 'first_name',
734+
order: 'Students.id',
735+
)
734736
->contain(['Courses'])
735737
->matching('Courses')
736738
->where(['CoursesMemberships.grade' => 'B']);

0 commit comments

Comments
 (0)