Could you please forward me to a good article about how to use Polymorphic relations? After making a few tries it seems the RelationRender fails to render poly relations if I use <?= $this->relationRender('tags'); ?> for example. I've tried to use in fields definition
tags:
label: Tags
type: checkboxlist
and checkboxes are rendered but relation data is not saved.
I'm trying to make a tags for the companies and categories :
Company:
public $morphMany = [
'tags' => ['Max\PluginName\Models\Tag', 'table' => 'max_taggables', 'name'=>'taggable'],
];
Tag:
public $morphTo = [
'companies' => ['Max\PluginName\Models\Company', 'table' => 'max_taggables', 'name'=>'taggable'],
];
I would like to acheeve the same relation form as for the belongsToMany relation which works fine with definition like:
tags:
label: Tags
view:
list: ~/plugins/max/pluginname/models/tag/columns.yaml
toolbarButtons: add|remove
manage:
showSearch: true
recordsPerPage: 10
list: ~/plugins/acme/cmmp/models/tag/columns.yaml
Last updated