octobercms/docs

The Has Many Through relationship description does not contain the otherKey parameter

igor-tv opened this issue · 1 comments

Has Many Through example looks like this:

public $hasManyThrough = [
    'posts' => [
        'Acme\Blog\Models\Post',
        'key'        => 'my_country_id',
        'through'    => 'Acme\Blog\Models\User',
        'throughKey' => 'my_user_id'
    ],
];

This example does not work correctly for me when outputting to the backend lists. But it starts working correctly when I add the otherKey parameter. Maybe you need to add it to the example in documentation?

public $hasManyThrough = [
    'posts' => [
        'Acme\Blog\Models\Post',
        'key'        => 'my_country_id',
        'otherKey'   => 'other_id',
        'through'    => 'Acme\Blog\Models\User',
        'throughKey' => 'my_user_id'
    ],
];

@igor-tv Please feel free to submit a PR to the docs with that addition, if you wish.