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


PHP ZurmoRedBean::count方法代码示例

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


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

示例1: testMultipleManyManysToTheSameModel

 public function testMultipleManyManysToTheSameModel()
 {
     $pp1 = new PP();
     $pp1->name = 'pp1a';
     $pp1->save();
     $this->assertTrue($pp1->save());
     $pp1Id = $pp1->id;
     $pp2 = new PP();
     $pp2->name = 'pp2a';
     $this->assertTrue($pp2->save());
     $pp2Id = $pp2->id;
     $p = new P();
     $p->name = 'manyNames';
     $p->ppManyAssumptive->add($pp1);
     $p->ppManySpecific->add($pp2);
     $this->assertTrue($p->save());
     $pId = $p->id;
     //Retrieve row to make sure columns are coppect
     $row = ZurmoRedBean::getRow('select * from p');
     $this->assertCount(5, $row);
     $this->assertEquals(1, ZurmoRedBean::count('p_pp'));
     $row = ZurmoRedBean::getRow('select * from p_pp');
     $this->assertTrue(isset($row['p_id']) && ($row['p_id'] = $p->id));
     $this->assertTrue(isset($row['pp_id']) && ($row['pp_id'] = $pp1->id));
     $this->assertCount(3, $row);
     $this->assertEquals(1, ZurmoRedBean::count('ppmanyspecificlink_p_pp'));
     $row = ZurmoRedBean::getRow('select * from ppmanyspecificlink_p_pp');
     $this->assertTrue(isset($row['p_id']) && ($row['p_id'] = $p->id));
     $this->assertTrue(isset($row['pp_id']) && ($row['pp_id'] = $pp2->id));
     $this->assertCount(3, $row);
     //Unlink and make sure the tables are cleared
     $p->forget();
     $pp1->forget();
     $pp2->forget();
     $p = P::getById($pId);
     $this->assertEquals(1, $p->ppManyAssumptive->count());
     $this->assertEquals(1, $p->ppManySpecific->count());
     $p->ppManyAssumptive->removeAll();
     $p->ppManySpecific->removeAll();
     $this->assertTrue($p->save());
     $this->assertEquals(0, ZurmoRedBean::count('p_pp'));
     $this->assertEquals(0, ZurmoRedBean::count('ppmanyspecificlink_p_pp'));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:43,代码来源:RedBeanModelMulitpleSameModelRelationsTest.php


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