This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have a problem with sorting relation field in belongsToMany relation:
public $belongsToMany = [
'attributes' => [
'Models\Attribute',
'table' => 'attributeset_attribute',
'order' => ['is_configurable desc', 'sort_order', 'name'],
'pivot' => ['is_configurable', 'sort_order'],
'pivotModel' => 'Models\AttributesetAttributePivot'
]
];
Everything works great, but when I click on the "Link" button, I recieve an error "1054 Unknown column 'is_configurable' in 'order clause'". Of course, I do not need ordering by pivot field, when linking an attribute. I tried changing the order in the controller:
public function onRelationButtonLink()
{
Attributeset::extend(function($model) {
$model->belongsToMany['attributes']['order'] = array('name');
});
return $this->asExtension('RelationController')->onRelationButtonLink();
}
After this I was able to open "Link" dialog, but when I tried to sort or search for some records, I received the same error. Is it possible to set different sorting criteria for the relation field list and "Link" form (include search)?
Did you ever figure this out, I've got exactly the same problem and I can't just drop the order to make the add function work
1-3 of 3