/** * {@inheritdoc} */ public function createListFromChoices($choices, $value = null) { if ($choices instanceof \Traversable) { $choices = iterator_to_array($choices); } // The value is not validated on purpose. The decorated factory may // decide which values to accept and which not. // We ignore the choice groups for caching. If two choice lists are // requested with the same choices, but a different grouping, the same // choice list is returned. DefaultChoiceListFactory::flatten($choices, $flatChoices); $hash = self::generateHash(array($flatChoices, $value), 'fromChoices'); if (!isset($this->lists[$hash])) { $this->lists[$hash] = $this->decoratedFactory->createListFromChoices($choices, $value); } return $this->lists[$hash]; }