当前位置: 首页>>代码示例>>PHP>>正文


PHP Facade::tag方法代码示例

本文整理汇总了PHP中RedBeanPHP\Facade::tag方法的典型用法代码示例。如果您正苦于以下问题:PHP Facade::tag方法的具体用法?PHP Facade::tag怎么用?PHP Facade::tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBeanPHP\Facade的用法示例。


在下文中一共展示了Facade::tag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchTaggedItems

 /**
  * 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);
 }
开发者ID:diego-vieira,项目名称:redbean,代码行数:26,代码来源:Tags.php

示例2: testFUSE

 /**
  * Test FUSE and model formatting.
  * 
  * @todo move tagging tests to tag tester.
  * 
  * @return void
  */
 public function testFUSE()
 {
     $toolbox = R::getToolBox();
     $adapter = $toolbox->getDatabaseAdapter();
     $blog = R::dispense('blog');
     $blog->title = 'testing';
     $blog->blog = 'tesing';
     R::store($blog);
     $blogpost = R::load("blog", 1);
     $post = R::dispense("post");
     $post->message = "hello";
     $blog->sharedPost[] = $post;
     R::store($blog);
     $a = R::getAll("select * from blog ");
     R::tag($post, "lousy,smart");
     asrt(implode(',', R::tag($post)), "lousy,smart");
     R::tag($post, "clever,smart");
     $tagz = implode(',', R::tag($post));
     asrt($tagz == "smart,clever" || $tagz == "clever,smart", TRUE);
     R::tag($blog, array("smart", "interesting"));
     asrt(implode(',', R::tag($blog)), "smart,interesting");
     try {
         R::tag($blog, array("smart", "interesting", "lousy!"));
         pass();
     } catch (RedException $e) {
         fail();
     }
     asrt(implode(',', R::tag($blog)), "smart,interesting,lousy!");
     asrt(implode(",", R::tag($blog)), "smart,interesting,lousy!");
     R::untag($blog, array("smart", "interesting"));
     asrt(implode(",", R::tag($blog)), "lousy!");
     asrt(R::hasTag($blog, array("lousy!")), TRUE);
     asrt(R::hasTag($blog, array("lousy!", "smart")), TRUE);
     asrt(R::hasTag($blog, array("lousy!", "smart"), TRUE), FALSE);
     R::tag($blog, FALSE);
     asrt(count(R::tag($blog)), 0);
     R::tag($blog, array("funny", "comic"));
     asrt(count(R::tag($blog)), 2);
     R::addTags($blog, array("halloween"));
     asrt(count(R::tag($blog)), 3);
     asrt(R::hasTag($blog, array("funny", "commic", "halloween"), TRUE), FALSE);
     R::unTag($blog, array("funny"));
     R::addTags($blog, "horror");
     asrt(count(R::tag($blog)), 3);
     asrt(R::hasTag($blog, array("horror", "commic", "halloween"), TRUE), FALSE);
     // No double tags
     R::addTags($blog, "horror");
     asrt(R::hasTag($blog, array("horror", "commic", "halloween"), TRUE), FALSE);
     asrt(count(R::tag($blog)), 3);
 }
开发者ID:skullyframework,项目名称:skully,代码行数:57,代码来源:Fuse.php


注:本文中的RedBeanPHP\Facade::tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。