Exemple #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 State (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->setName($this->getName());
     $copyObj->setCountryId($this->getCountryId());
     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->getBranchCoverages() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addBranchCoverage($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getUserProfiles() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addUserProfile($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getCities() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addCity($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getAreas() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addArea($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->getStores() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addStore($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
     }
 }
Exemple #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 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
     }
 }