/** * Returns an array map from the product's values. * * @return array The map data for the product. */ public function getMap() { $map = parent::getMap(); ArrayUtils::addIfNotNull($map, 'price', $this->getPrice()); ArrayUtils::addIfNotNull($map, 'title', $this->getTitle()); ArrayUtils::addIfNotNull($map, 'currency', $this->getCurrency()); ArrayUtils::addIfNotNull($map, 'categoryId', $this->getCategoryId()); ArrayUtils::addIfNotNull($map, 'type', $this->getType()); ArrayUtils::addIfNotNull($map, 'customAmount', $this->getCustomAmount()); ArrayUtils::addIfNotNull($map, 'subscriptionRenewal', $this->getSubscriptionRenewal()); ArrayUtils::addIfNotNull($map, 'failedPayment', $this->getFailedPayment()); return $map; }
/** * Accepts relevant request parameters from a {@link \Plenigo\models\Product} instance. * * @param AbstractProduct $product The product instance to extract values from. * * @return void */ public function setProduct(AbstractProduct $product) { $productMap = $product->getMap(); $map = array(); ArrayUtils::addIfDefined($map, 'productId', $productMap, 'id'); ArrayUtils::addIfDefined($map, 'price', $productMap, 'price'); ArrayUtils::addIfDefined($map, 'title', $productMap, 'title'); ArrayUtils::addIfDefined($map, 'categoryId', $productMap, 'categoryId'); ArrayUtils::addIfDefined($map, 'currency', $productMap, 'currency'); ArrayUtils::addIfDefined($map, 'type', $productMap, 'type'); ArrayUtils::addIfDefined($map, 'subscriptionRenewal', $productMap, 'subscriptionRenewal'); $this->setValuesFromMap($map); }
/** * Returns an array map from the product's values. * * @return array The map data for the product. */ public function getMap() { $map = array(); ArrayUtils::addIfNotNull($map, 'id', $this->getId()); return $map; }