This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Troiscent
Troiscent

Hello,

I have a custom Blog plugin, that contain Post and Category Models.

A blog post can have multiple categories, a category can have multiple posts. So I defined 2 $belongToMany.

My problem is about backend list filtering, I'm trying to filter by categories on my post listing, so I defined a config_filter.yaml like that :

scopes:
    categories:
        label: publipresse.blog::lang.post.categories
        modelClass: Publipresse\Blog\Models\Category
        conditions: id in (:filtered)
        nameFrom: title

It don't throw me any errors, but the filter doesn't works. it seems that it look to the post ID for the condition instead of the category ID.

As it's a many to many relation, I don't have any "category_id" column to my post table, I have a third table with "post_id" and "category_id" to handle the relation, and the documentation is lacking of some examples to create a filter that is based on a "many to many" relationship.

Could you point me the right syntax to make my filter to work ?

mmarfil13840
mmarfil13840

I have same problem any solutions?

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.