コード例 #1
0
ファイル: TagManager.php プロジェクト: up9cloud/redbean
 /**
  * Finds a tag bean by it's title.
  * Internal method.
  *
  * @param string $title title to search for
  *
  * @return OODBBean
  */
 protected function findTagByTitle($title)
 {
     $beans = $this->redbean->find('tag', array('title' => array($title)));
     if ($beans) {
         $bean = reset($beans);
         return $bean;
     }
     return NULL;
 }
コード例 #2
0
ファイル: TagManager.php プロジェクト: cesium147/redbean
 /**
  * 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.
  *
  * @param string       $beanType type of bean you are looking for
  * @param array|string $tagList  list of tags to match
  *
  * @return array
  */
 public function tagged($beanType, $tagList)
 {
     $tags = $this->extractTagsIfNeeded($tagList);
     $collection = array();
     $tags = $this->redbean->find('tag', array('title' => $tags));
     $list = 'shared' . ucfirst($beanType);
     if (is_array($tags) && count($tags) > 0) {
         foreach ($tags as $tag) {
             $collection += $tag->{$list};
         }
     }
     return $collection;
 }