Class TagManager
RedBeanPHP Tag Manager.
The tag manager offers an easy way to quickly implement basic tagging
functionality.
Provides methods to tag beans and perform tag-based searches in the
bean database.
Namespace: RedBeanPHP
Copyright:
copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community
This source file is subject to the BSD/GPLv2 License that is bundled
with this source code in the file license.txt.
License:
BSD/GPLv2
Author:
Gabor de Mooij and the RedBeanPHP community
File:
RedBeanPHP/TagManager.php
Located at TagManager.php
Methods summary
protected
RedBeanPHP\OODBBean
|
#
findTagByTitle( string $title )
Finds a tag bean by it's title.
Internal method.
Finds a tag bean by it's title.
Internal method.
Parameters
- $title
- title to search for
Returns
|
public
|
#
__construct( RedBeanPHP\ToolBox $toolbox )
Constructor.
The tag manager offers an easy way to quickly implement basic tagging
functionality.
Constructor.
The tag manager offers an easy way to quickly implement basic tagging
functionality.
Parameters
|
public
boolean
|
#
hasTag( RedBeanPHP\OODBBean $bean, array|string $tags, boolean $all = FALSE )
Tests whether a bean has been associated with one ore more
of the listed tags. If the third parameter is TRUE this method
will return TRUE only if all tags that have been specified are indeed
associated with the given bean, otherwise FALSE.
If the third parameter is FALSE this
method will return TRUE if one of the tags matches, FALSE if none
match.
Tests whether a bean has been associated with one ore more
of the listed tags. If the third parameter is TRUE this method
will return TRUE only if all tags that have been specified are indeed
associated with the given bean, otherwise FALSE.
If the third parameter is FALSE this
method will return TRUE if one of the tags matches, FALSE if none
match.
Tag list can be either an array with tag names or a comma separated list
of tag names.
Parameters
- $bean
- bean to check for tags
- $tags
- list of tags
- $all
- whether they must all match or just some
Returns
boolean
|
public
|
#
untag( RedBeanPHP\OODBBean $bean, array|string $tagList )
Removes all sepcified tags from the bean. The tags specified in
the second parameter will no longer be associated with the bean.
Removes all sepcified tags from the bean. The tags specified in
the second parameter will no longer be associated with the bean.
Tag list can be either an array with tag names or a comma separated list
of tag names.
Parameters
- $bean
- tagged bean
- $tagList
- list of tags (names)
|
public
array
|
#
tag( RedBeanPHP\OODBBean $bean, array|string $tagList = NULL )
Tags a bean or returns tags associated with a bean.
If $tagList is NULL or omitted this method will return a
comma separated list of tags associated with the bean provided.
If $tagList is a comma separated list (string) of tags all tags will
be associated with the bean.
You may also pass an array instead of a string.
Tags a bean or returns tags associated with a bean.
If $tagList is NULL or omitted this method will return a
comma separated list of tags associated with the bean provided.
If $tagList is a comma separated list (string) of tags all tags will
be associated with the bean.
You may also pass an array instead of a string.
Tag list can be either an array with tag names or a comma separated list
of tag names.
Parameters
- $bean
- bean to be tagged
- $tagList
- a list of tags
Returns
array
|
public
|
#
addTags( RedBeanPHP\OODBBean $bean, array|string $tagList )
Adds tags to a bean.
If $tagList is a comma separated list of tags all tags will
be associated with the bean.
You may also pass an array instead of a string.
Adds tags to a bean.
If $tagList is a comma separated list of tags all tags will
be associated with the bean.
You may also pass an array instead of a string.
Tag list can be either an array with tag names or a comma separated list
of tag names.
Parameters
- $bean
- bean to add tags to
- $tagList
- list of tags to add to bean
|
public
array
|
#
tagged( string $beanType, array|string $tagList, string $sql = '', array $bindings = array() )
Returns all beans that have been tagged with one or more
of the specified tags.
Returns all beans that have been tagged with one or more
of the specified tags.
Tag list can be either an array with tag names or a comma separated list
of tag names.
Parameters
- $beanType
- type of bean you are looking for
- $tagList
- list of tags to match
- $sql
- additional SQL (use only for pagination)
- $bindings
- bindings
Returns
array
|
public
array
|
#
taggedAll( string $beanType, array|string $tagList, $sql = '', $bindings = array() )
Returns all beans that have been tagged with ALL of the tags given.
Returns all beans that have been tagged with ALL of the tags given.
Tag list can be either an array with tag names or a comma separated list
of tag names.
Parameters
- $beanType
- type of bean you are looking for
- $tagList
- list of tags to match
- $sql
- $bindings
Returns
array
|