/** * @param WishListItem $WishListItem * @param \DateTime $addedOn overwrites the added_on date; if given * * @return $this */ public function updateItem(WishListItem $WishListItem, \DateTime $addedOn = null) { $itemId = $WishListItem->getId(); $item = ['variant_id' => $WishListItem->getVariantId(), 'app_id' => $WishListItem->getAppId()]; if ($itemId) { $item['id'] = $itemId; } $additionalData = $WishListItem->getAdditionalData(); if (!empty($additionalData)) { $this->checkAdditionData($additionalData); $item['additional_data'] = (array) $additionalData; } if ($addedOn) { $item['added_on'] = $addedOn->format('Y-m-d'); } if ($itemId) { $this->updatedItems[$WishListItem->getId()] = $item; } else { $this->updatedItems[] = $item; } return $this; }
/** * {@inheritdoc} * * @return WishList\WishListItem */ public function createWishListItem(stdClass $jsonObject, array $products) { return WishList\WishListItem::createFromJson($jsonObject, $products); }