コード例 #1
0
ファイル: ContainerTest.php プロジェクト: squareproton/bond
 public function testContainerRandomGetRemoveElements()
 {
     $container = new Container();
     foreach (range(1, 5) as $n) {
         $container->add(new EBTC(array('id' => $n)));
     }
     $container->randomGet(2, null, true);
     $this->assertSame($container->count(), 3);
     $container->randomGet(null, null, true);
     $this->assertSame($container->count(), 2);
     $container->randomGet(8, null, true);
     $this->assertSame($container->count(), 0);
 }
コード例 #2
0
ファイル: PgAttribute.php プロジェクト: squareproton/bond
 /**
  * Get all inherited Attributes
  * @return Container
  */
 public function getChildren()
 {
     $output = new BaseContainer();
     foreach ($this->getRelation()->getChildren() as $childRelation) {
         $childAttribute = $childRelation->getAttributeByName($this->name);
         $output->add($childAttribute, $childAttribute->getChildren());
     }
     return $output;
 }