Skip to content

Tags with different categories #11

@nirvana-msu

Description

@nirvana-msu

Such taggable behaviors are a convenient way to store information for attributes that can take an array of values. And sometimes it is convenient to store information about different attributes in the same table using a special column to distinguish, say, category. What would be very useful if this extension allowed to work (save, load, search etc) with multiple tag categories defined for the same model.

This functionality was available in Yii1 through taggable extension by @samdark and was very useful.

You could potentially build on top of existing approach by attaching multiple TaggableBehavior behaviors, one per tag category, and adding a specific where clause like ->where('category = :category', [':category' => $category]); to each relation. But it has certain problems:

  • TaggableQueryBehavior right now does not distinguish between owner's behaviors and uses $model->tagRelation which would reference a relation from the first bahavior it finds instead of the one we need.
  • When saving tags, would be nice if tag category was saved automatically. This was handled by insertValues property in Yii1 taggable extension.
  • Yii1 taggable extension also provided useful methods like getAllTagsWithModelsCount, but this is less critical.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions