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 Role (or compatible) type.
  * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  * @throws     PropelException
  */
 public function copyInto($copyObj, $deepCopy = false)
 {
     $copyObj->setTitle($this->title);
     $copyObj->setStatus($this->status);
     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->getEmployees() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addEmployee($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getUsers() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addUser($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     $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 \Person (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->setCompany($this->getCompany());
     $copyObj->setFirstname($this->getFirstname());
     $copyObj->setLastname($this->getLastname());
     $copyObj->setAddress($this->getAddress());
     $copyObj->setZip($this->getZip());
     $copyObj->setCity($this->getCity());
     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->getCustomers() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addCustomer($relObj->copy($deepCopy));
             }
         }
         foreach ($this->getEmployees() as $relObj) {
             if ($relObj !== $this) {
                 // ensure that we don't try to copy a reference to ourselves
                 $copyObj->addEmployee($relObj->copy($deepCopy));
             }
         }
     }
     // if ($deepCopy)
     if ($makeNew) {
         $copyObj->setNew(true);
         $copyObj->setId(NULL);
         // this is a auto-increment column, so set to default value
     }
 }