This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
jfo
Hi, I've set my relations 'order' property in the hope of having my data ordered by the specified column. Here is the relation definition of my model:
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'someFieldNotCalledId';
...
public $hasMany = [
'children' => [
'\My\Plugin\Models\Child',
'key' => 'someFieldNotCalledId',
'order' => 'someOtherField'
],
];
However, when loading my model I have this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'order clause' (SQL: select `child`.* from `child` where `child`.`someFieldNotCalledId` = 123 and `child`.`someFieldNotCalledId` is not null **order by `id` desc**)
Why is it setting an order by id
clause?
Where else should I change the order key?
Any help is appreciated. Thanks!
1-1 of 1