/** * Creates a version of the current object and saves it. * * @param ConnectionInterface $con the connection to use * * @return ChildCouponVersion A version object */ public function addVersion($con = null) { $this->enforceVersion = false; $version = new ChildCouponVersion(); $version->setId($this->getId()); $version->setCode($this->getCode()); $version->setType($this->getType()); $version->setSerializedEffects($this->getSerializedEffects()); $version->setIsEnabled($this->getIsEnabled()); $version->setStartDate($this->getStartDate()); $version->setExpirationDate($this->getExpirationDate()); $version->setMaxUsage($this->getMaxUsage()); $version->setIsCumulative($this->getIsCumulative()); $version->setIsRemovingPostage($this->getIsRemovingPostage()); $version->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers()); $version->setIsUsed($this->getIsUsed()); $version->setSerializedConditions($this->getSerializedConditions()); $version->setPerCustomerUsageCount($this->getPerCustomerUsageCount()); $version->setCreatedAt($this->getCreatedAt()); $version->setUpdatedAt($this->getUpdatedAt()); $version->setVersion($this->getVersion()); $version->setVersionCreatedAt($this->getVersionCreatedAt()); $version->setVersionCreatedBy($this->getVersionCreatedBy()); $version->setCoupon($this); $version->save($con); return $version; }