Skip to content

tagme/propel-taggable-behavior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

TaggableBehavior

Installation

Download TaggableBehavior.php and put it somewhere.

propel.behavior.taggable.class = path.to.taggable.behavior

If you are using composer then just add:

{
    "require": {
        "smirik/propel-taggable-behavior": "*"
    }
}

The ini-configuration would be

propel.behavior.taggable.class = vendor.smirik.src.propel-taggable-behavior.src.TaggableBehavior

Usage

Behavior creates two persistent tables:

  • tags (id, category_id, name)
  • tags_categories (id, name)

Tags are realted to tags categories. Relation field category_id is not required.

Add to schema.xml:

<behavior name="taggable" />

Behavior will add several methods to the Model:

public function addTags($tags, $category_id = null, PropelPDO $con = null)
public function removeTags($tags, $category_id = null)
public function addTag(Tag $tag)
public function removeTag(Tag $tag)

category_id is optional parameter.

Requirements

Credits

About

Tags for propel as separate behavior

Resources

Stars

Watchers

Forks

Packages

No packages published