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'm currently building a plugin which needs a simple category/sub-category implementation. I decided to use the SimpleTree trait, since the NestedTree is too complex for what I want to achieve. However, for some reason it doesn't seem to work.
When I use the "type: relation" in my forms.yaml file, it keeps telling me there is no definition for "parent" in the model, while I think I might assume this would be solved by the SimpleTree implementation. I tried to get around this by adding the "parent" definition as a $hasOne, $belongsTo etc. But to no avail.
Another problem caused by this is the user being able to select a category as its own parent... Which is totally wrong. I've been trying to get it fixed, but no luck so far. Hope someone can help me out.
Last updated
Post some sample code on the github issues list, so it can be replicated, and I will take a look.
Category model => http://www.codeshare.io/kS2bt
Category fields.yaml => http://www.codeshare.io/LwyAU
Here's the code. Apparently it works for the forum plugin when using nested trees... Would expect similar functionality with SimpleTree
Last updated
Worked for me, but I had to define the relations in the model:
public $hasMany = [
'children' => ['\Celepar\Catalogo\Models\TipoServico']
];
public $belongsTo = [
'parent' => ['\Celepar\Catalogo\Models\TipoServico']
];
Last updated
1-5 of 5