/**
  * {@inheritdoc}
  */
 public function getValues()
 {
     if ($this->ajax) {
         return array();
     }
     return parent::getValues();
 }
 /**
  * @expectedException \Symfony\Component\Form\Exception\StringCastException
  * @expectedMessage   Entity "Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity" passed to the choice field must have a "__toString()" method defined (or you can also override the "property" option).
  */
 public function testEntitiesMustHaveAToStringMethod()
 {
     $entity1 = new SingleIntIdNoToStringEntity(1, 'Foo');
     $entity2 = new SingleIntIdNoToStringEntity(2, 'Bar');
     // Persist for managed state
     $this->em->persist($entity1);
     $this->em->persist($entity2);
     $choiceList = new EntityChoiceList($this->em, self::SINGLE_INT_ID_CLASS, null, null, array($entity1, $entity2));
     $choiceList->getValues();
 }