RedBeanPHP

easy ORM for PHP

Tags

Tags are often used to categorize or group items into meaningful groups. To tag a an item:


 R
::tag$page, array('topsecret','mi6') );

To fetch all tags attached to a certain bean we use the same method but without the tag parameter:


$tags 
R::tag$page ); //returns array with tags

To untag an item use

 
R
::untag($bean,$tagListArray);

To get all beans that have been tagged with $tags, use tagged():

 
R
::tagged$beanType$tagList );

To find out whether beans have been tagged with specific tags, use hasTag():

 
R
::hasTag($bean$tags$all=false)

To add tags without removing the old ones:


 R
::addTags$page, array('funny','hilarious') );

To get beans that have ALL these tags: (since 3.2)


 R
::taggedAll$page, array('funny','hilarious') ); //must be tagged with both tags


User contributed notes. Please use the comment section to provide tips, notes and examples. To ask for support or to provide feedback use the forum. For bug reports use Github Issue Tracker.

Site comments powered by Disqus

page generated in 0.010694026947021 sec.