/**
  * {@inheritdoc}
  */
 public function getRemainingViews()
 {
     if ($this->ajax) {
         return array();
     }
     return parent::getRemainingViews();
 }
 public function testGroupByPropertyPath()
 {
     $item1 = new GroupableEntity(1, 'Foo', 'Group1');
     $item2 = new GroupableEntity(2, 'Bar', 'Group1');
     $item3 = new GroupableEntity(3, 'Baz', 'Group2');
     $item4 = new GroupableEntity(4, 'Boo!', null);
     $this->em->persist($item1);
     $this->em->persist($item2);
     $this->em->persist($item3);
     $this->em->persist($item4);
     $choiceList = new EntityChoiceList($this->em, self::GROUPABLE_CLASS, 'name', null, array($item1, $item2, $item3, $item4), array(), 'groupName');
     $this->assertEquals(array(1 => $item1, 2 => $item2, 3 => $item3, 4 => $item4), $choiceList->getChoices());
     $this->assertEquals(array('Group1' => array(1 => new ChoiceView($item1, '1', 'Foo'), 2 => new ChoiceView($item2, '2', 'Bar')), 'Group2' => array(3 => new ChoiceView($item3, '3', 'Baz')), 4 => new ChoiceView($item4, '4', 'Boo!')), $choiceList->getRemainingViews());
 }
예제 #3
0
 public function testGroupBySupportsString()
 {
     $item1 = new ItemGroupEntity(1, 'Foo', 'Group1');
     $item2 = new ItemGroupEntity(2, 'Bar', 'Group1');
     $item3 = new ItemGroupEntity(3, 'Baz', 'Group2');
     $item4 = new ItemGroupEntity(4, 'Boo!', null);
     $this->em->persist($item1);
     $this->em->persist($item2);
     $this->em->persist($item3);
     $this->em->persist($item4);
     $choiceList = new EntityChoiceList($this->em, self::ITEM_GROUP_CLASS, 'name', null, array($item1, $item2, $item3, $item4), 'groupName');
     $this->assertEquals(array(1 => $item1, 2 => $item2, 3 => $item3, 4 => $item4), $choiceList->getChoices());
     $this->assertEquals(array('Group1' => array(1 => new ChoiceView('1', 'Foo'), 2 => new ChoiceView('2', 'Bar')), 'Group2' => array(3 => new ChoiceView('3', 'Baz')), 4 => new ChoiceView('4', 'Boo!')), $choiceList->getRemainingViews());
 }