public function testGetAllOptionValuesByIds() { $originalOptionValue = $this->setupOptionValue(); $this->setCountLogger(); $optionValues = $this->optionValueRepository->getAllOptionValuesByIds([$originalOptionValue->getId()]); $optionValues[0]->getOption()->getCreated(); $this->assertEquals($originalOptionValue->getId(), $optionValues[0]->getId()); $this->assertSame(1, $this->getTotalQueries()); }
/** * @param UuidInterface $cartItemId * @param UuidInterface[] $optionValueIds * @throws EntityNotFoundException */ public function addItemOptionValues(UuidInterface $cartItemId, array $optionValueIds) { $optionValues = $this->optionValueRepository->getAllOptionValuesByIds($optionValueIds); $cartItem = $this->cartRepository->getItemById($cartItemId); $cart = $cartItem->getCart(); foreach ($optionValues as $optionValue) { $cartItemOptionValue = new CartItemOptionValue(); $cartItemOptionValue->setOptionValue($optionValue); $cartItem->addCartItemOptionValue($cartItemOptionValue); } $this->cartRepository->update($cart); }