/** * 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 Store (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->setName($this->getName()); $copyObj->setOwner($this->getOwner()); $copyObj->setAddress($this->getAddress()); $copyObj->setCountryId($this->getCountryId()); $copyObj->setStateId($this->getStateId()); $copyObj->setRegionId($this->getRegionId()); $copyObj->setCityId($this->getCityId()); $copyObj->setAreaId($this->getAreaId()); $copyObj->setZipcode($this->getZipcode()); $copyObj->setPhone($this->getPhone()); $copyObj->setStoreType($this->getStoreType()); $copyObj->setDescription($this->getDescription()); $copyObj->setIsActive($this->getIsActive()); $copyObj->setUrl($this->getUrl()); $copyObj->setSortableRank($this->getSortableRank()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; foreach ($this->getVisitations() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addVisitation($relObj->copy($deepCopy)); } } //unflag object copy $this->startCopy = false; } // 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 User (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->setUsername($this->getUsername()); $copyObj->setUsernameCanonical($this->getUsernameCanonical()); $copyObj->setEmail($this->getEmail()); $copyObj->setEmailCanonical($this->getEmailCanonical()); $copyObj->setEnabled($this->getEnabled()); $copyObj->setSalt($this->getSalt()); $copyObj->setPassword($this->getPassword()); $copyObj->setLastLogin($this->getLastLogin()); $copyObj->setLocked($this->getLocked()); $copyObj->setExpired($this->getExpired()); $copyObj->setExpiresAt($this->getExpiresAt()); $copyObj->setConfirmationToken($this->getConfirmationToken()); $copyObj->setPasswordRequestedAt($this->getPasswordRequestedAt()); $copyObj->setCredentialsExpired($this->getCredentialsExpired()); $copyObj->setCredentialsExpireAt($this->getCredentialsExpireAt()); $copyObj->setType($this->getType()); $copyObj->setStatus($this->getStatus()); $copyObj->setRoles($this->getRoles()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); if ($deepCopy && !$this->startCopy) { // important: temporarily setNew(false) because this affects the behavior of // the getter/setter methods for fkey referrer objects. $copyObj->setNew(false); // store object hash to prevent cycle $this->startCopy = true; foreach ($this->getAreaAssignments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addAreaAssignment($relObj->copy($deepCopy)); } } foreach ($this->getUserGroups() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUserGroup($relObj->copy($deepCopy)); } } foreach ($this->getUserLogs() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addUserLog($relObj->copy($deepCopy)); } } foreach ($this->getPrincipals() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addPrincipal($relObj->copy($deepCopy)); } } foreach ($this->getProductAssignments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProductAssignment($relObj->copy($deepCopy)); } } foreach ($this->getVisitations() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addVisitation($relObj->copy($deepCopy)); } } $relObj = $this->getUserProfile(); if ($relObj) { $copyObj->setUserProfile($relObj->copy($deepCopy)); } //unflag object copy $this->startCopy = false; } // if ($deepCopy) if ($makeNew) { $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value } }