tagged() public static method

Returns all beans that have been tagged with one of the tags given.
public static tagged ( string $beanType, array $tagList, string $sql = '', array $bindings = [] ) : array
$beanType string type of bean you are looking for
$tagList array list of tags to match
$sql string additional SQL query snippet
$bindings array a list of values to bind to the query parameters
return array
Example #1
0
 /**
  * Fetching tagged items.
  *
  * @return void
  */
 public function fetchTaggedItems()
 {
     $b = R::dispense("book");
     $b->title = 'horror';
     R::store($b);
     $c = R::dispense("book");
     $c->title = 'creepy';
     R::store($c);
     $d = R::dispense("book");
     $d->title = "chicklit";
     R::store($d);
     R::tag($b, "horror,classic");
     R::tag($d, "women,classic");
     R::tag($c, "horror");
     $x = R::tagged("book", "classic");
     asrt(count($x), 2);
     $x = R::tagged("book", "classic,horror");
     asrt(count($x), 3);
     $x = R::tagged("book", array("classic", "horror"));
     asrt(count($x), 3);
 }