Skip to content

Commit

Permalink
Fixing the customer option factory
Browse files Browse the repository at this point in the history
  • Loading branch information
mamazu committed Oct 25, 2021
1 parent 347ad32 commit 684975a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Factory/OrderItemOptionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public function createForOptionAndValue(
public function createNewFromStrings(
OrderItemInterface $orderItem,
string $customerOptionCode,
string $customerOptionValue
$customerOptionValue
): OrderItemOptionInterface {
$customerOption = $this->customerOptionRepository->findOneByCode($customerOptionCode);
if ($customerOption === null) {
throw new Exception('Could not find customer option with code');
}

if (CustomerOptionTypeEnum::isSelect($customerOption->getType())) {
$customerOptionValue = $this->valueResolver->resolve($customerOption, $customerOptionValue);
$customerOptionValue = $this->valueResolver->resolve($customerOption, (string) $customerOptionValue);
}

return $this->createForOptionAndValue($orderItem, $customerOption, $customerOptionValue);
Expand Down
10 changes: 5 additions & 5 deletions src/Factory/OrderItemOptionFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface OrderItemOptionFactoryInterface
/**
* @param CustomerOptionInterface $customerOption
* @param mixed $customerOptionValue
* @param OrderItemInterface $orderItem
* @param OrderItemInterface $orderItem
*
* @return OrderItemOptionInterface
*/
Expand All @@ -34,15 +34,15 @@ public function createForOptionAndValue(
/**
* Creates an OrderItemOption based on the two input strings
*
* @param string $customerOptionCode The code of teh customer option
* @param string $customerOptionValue The code of the value if it is a select else just the value itself
* @param OrderItemInterface $orderItem
* @param string $customerOptionCode The code of teh customer option
* @param mixed $customerOptionValue The code of the value if it is a select else just the value itself
* @param OrderItemInterface $orderItem
*
* @return OrderItemOptionInterface
*/
public function createNewFromStrings(
OrderItemInterface $orderItem,
string $customerOptionCode,
string $customerOptionValue
$customerOptionValue
): OrderItemOptionInterface;
}

0 comments on commit 684975a

Please sign in to comment.