XF 2.1 Entity relation is not populated when using a key in relation?

Jaxel

Well-known member
I have a relation in my $package:
Code:
            'Pages' => [
                'entity' => 'EWR\Scoreboard:Page',
                'type' => self::TO_MANY,
                'conditions' => 'package_id',
                'order' => 'page_order',
            ],

If I do: \XF::dump($package->Pages);, I properly get all the pages within this package.

The primary key of this relation is page_id; but I want the results keyed by a different value... so I change the relation to:
Code:
            'Pages' => [
                'entity' => 'EWR\Scoreboard:Page',
                'type' => self::TO_MANY,
                'conditions' => 'package_id',
                'order' => 'page_order',
                'key' => 'page_key',
            ],

However, when I do \XF::dump($package->Pages);, I don't get any entities, and the finder collection has #populated: false.

How do I fix this?

`
 
Back
Top Bottom