k3dbe / propel-taggable-behavior
为对象添加标签功能。
dev-master
2015-05-28 16:02 UTC
This package is not auto-updated.
Last update: 2024-09-18 07:51:43 UTC
README
安装
下载TaggableBehavior.php并将其放置在某个位置。
propel.behavior.taggable.class = path.to.taggable.behavior
如果您使用composer,则只需添加
{ "require": { "k3dbe/propel-taggable-behavior": "dev-master" } }
ini配置将是
propel.behavior.taggable.class = vendor.k3dbe.src.propel-taggable-behavior.src.TaggableBehavior
用法
行为创建两个持久表
- tag (id, name)
- %table%_tag
添加到schema.xml
<behavior name="taggable" />
行为将为模型添加几个方法
public function addTags($tags, PropelPDO $con = null) public function removeTags($tags, PropelPDO $con = null) public function addTag(Tag $tag) public function removeTag(Tag $tag) public function removeAllTags(PropelPDO $con = null)