objectManager = $objectManager; $this->customizableOptionValues = $customizableOptionValues; } /** * @inheritdoc */ public function getData( QuoteItem $cartItem, Option $option, SelectedOption $selectedOption ): array { $optionType = $option->getType(); if (!array_key_exists($optionType, $this->customizableOptionValues)) { throw new GraphQlInputException(__('Option type "%1" is not supported', $optionType)); } $customizableOptionValueClassName = $this->customizableOptionValues[$optionType]; $customizableOptionValue = $this->objectManager->get($customizableOptionValueClassName); if (!$customizableOptionValue instanceof CustomizableOptionValueInterface) { throw new LocalizedException( __('%1 doesn\'t implement CustomizableOptionValueInterface', $customizableOptionValueClassName) ); } return $customizableOptionValue->getData($cartItem, $option, $selectedOption); } }