/** * Constructs * * @param LegacyChoiceListAdapter $choiceList * @param boolean $ajax * @param string $widget * @param bool $multiple */ public function __construct(LegacyChoiceListAdapter $choiceList, $ajax = false, $widget = 'choice', $multiple = false) { $this->choiceList = $choiceList->getAdaptedList(); $this->ajax = $ajax; $this->multiple = $multiple; $this->widget = $widget; }
/** * @param ModelChoiceList|LegacyChoiceListAdapter $choiceList */ public function __construct($choiceList) { if ($choiceList instanceof LegacyChoiceListAdapter && $choiceList->getAdaptedList() instanceof ModelChoiceList) { $this->choiceList = $choiceList->getAdaptedList(); } elseif ($choiceList instanceof ModelChoiceList) { $this->choiceList = $choiceList; } else { new \InvalidArgumentException('Argument 1 passed to ' . __CLASS__ . '::' . __METHOD__ . ' must be an instance of Sonata\\AdminBundle\\Form\\ChoiceList\\ModelChoiceList, instance of ' . get_class($choiceList) . ' given'); } }
public function testGetAdaptedList() { $this->assertSame($this->adaptedList, $this->list->getAdaptedList()); }