/** * @param TextOptionValueDTO[] $textOptionValueDTOs * @return ArrayCollection|TextOption[] */ private function getTextOptionsCollection(array $textOptionValueDTOs) { $textOptionIds = []; foreach ($textOptionValueDTOs as $textOptionValueDTO) { $textOptionIds[] = $textOptionValueDTO->getTextOptionId(); } $textOptions = $this->textOptionRepository->getAllTextOptionsByIds($textOptionIds); $textOptionCollection = new ArrayCollection(); foreach ($textOptions as $textOption) { $textOptionCollection->set($textOption->getId()->getHex(), $textOption); } return $textOptionCollection; }
public function testGetAllOptionsByIds() { $originalTextOption = $this->setupOption(); $textOptions = $this->textOptionRepository->getAllTextOptionsByIds([$originalTextOption->getId()]); $this->assertEntitiesEqual($originalTextOption, $textOptions[0]); }