Closed JohnnyMcWeed closed 6 years ago
@JohnnyMcWeed If you create a new item with the RELATIONS-BUTTON the item won't be selected, this is an expected behavior. So i assume its not a bug.
I've got a service model where I added related services.
class Service extends NgRestModel
{
...
'isRelatedTo' => [
'class' => CheckboxRelationActiveQuery::class,
'query' => $this->getIsRelatedTo(),
'labelField' => ['title']
]
...
public function getIsRelatedTo() {
return $this->hasMany(Service::class, ['id' => 'relation_service_id'])->viaTable('service_is_related_to', ['service_id' => 'id']);
}
}
This works quite well so when adding new elements it saves everything as expected. The problem comes if I'd like to change something later. When opening the service, the related services are not selected anymore. So the next time the service is saved, all related services get removed if I don't remember to select them again each time..
Issue moved to https://github.com/luyadev/luya-module-admin/issues/145
What steps will reproduce the problem?
What is the expected result?
What do you get instead? (A Screenshot can help us a lot!)
Database: Items are saved as expected.