/** * 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 } }
/** * 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\Profile (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->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->getAdmins() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addAdmin($relObj->copy($deepCopy)); } } foreach ($this->getProfileResources() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProfileResource($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->getApis() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addApi($relObj->copy($deepCopy)); } } foreach ($this->getProfileI18ns() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProfileI18n($relObj->copy($deepCopy)); } } } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }