Exemplo n.º 1
0
 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param      object $copyObj An object of \Thelia\Model\OrderCoupon (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
  * @throws PropelException
  */
 public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
 {
     $copyObj->setOrderId($this->getOrderId());
     $copyObj->setCode($this->getCode());
     $copyObj->setType($this->getType());
     $copyObj->setAmount($this->getAmount());
     $copyObj->setTitle($this->getTitle());
     $copyObj->setShortDescription($this->getShortDescription());
     $copyObj->setDescription($this->getDescription());
     $copyObj->setExpirationDate($this->getExpirationDate());
     $copyObj->setIsCumulative($this->getIsCumulative());
     $copyObj->setIsRemovingPostage($this->getIsRemovingPostage());
     $copyObj->setIsAvailableOnSpecialOffers($this->getIsAvailableOnSpecialOffers());
     $copyObj->setSerializedConditions($this->getSerializedConditions());
     $copyObj->setPerCustomerUsageCount($this->getPerCustomerUsageCount());
     $copyObj->setCreatedAt($this->getCreatedAt());
     $copyObj->setUpdatedAt($this->getUpdatedAt());
     if ($deepCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         foreach ($this->getOrderCouponCountries() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addOrderCouponCountry($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getOrderCouponModules() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addOrderCouponModule($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }
Exemplo n.º 2
0
 /**
  * Sets contents of passed object to values from current object.
  *
  * If desired, this method can also make copies of all associated (fkey referrers)
  * objects.
  *
  * @param      object $copyObj An object of \Thelia\Model\Module (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @param      boolean $makeNew Whether to reset autoincrement PKs and make the object new.
  * @throws PropelException
  */
 public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
 {
     $copyObj->setCode($this->getCode());
     $copyObj->setType($this->getType());
     $copyObj->setActivate($this->getActivate());
     $copyObj->setPosition($this->getPosition());
     $copyObj->setFullNamespace($this->getFullNamespace());
     $copyObj->setCreatedAt($this->getCreatedAt());
     $copyObj->setUpdatedAt($this->getUpdatedAt());
     if ($deepCopy) {
         // important: temporarily setNew(false) because this affects the behavior of
         // the getter/setter methods for fkey referrer objects.
         $copyObj->setNew(false);
         foreach ($this->getOrdersRelatedByPaymentModuleId() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addOrderRelatedByPaymentModuleId($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getOrdersRelatedByDeliveryModuleId() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addOrderRelatedByDeliveryModuleId($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getAreaDeliveryModules() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addAreaDeliveryModule($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getProfileModules() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addProfileModule($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getModuleImages() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addModuleImage($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getCouponModules() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addCouponModule($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getOrderCouponModules() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addOrderCouponModule($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getModuleHooks() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addModuleHook($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getModuleConfigs() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addModuleConfig($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getModuleI18ns() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addModuleI18n($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }