/** * 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 Account (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->setAddressId($this->getAddressId()); $copyObj->setIdentifier($this->getIdentifier()); $copyObj->setName($this->getName()); 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->getBookingTypes() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addBookingType($relObj->copy($deepCopy)); } } foreach ($this->getClockingTypes() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addClockingType($relObj->copy($deepCopy)); } } foreach ($this->getDomains() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addDomain($relObj->copy($deepCopy)); } } foreach ($this->getHolidays() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addHoliday($relObj->copy($deepCopy)); } } foreach ($this->getPlugins() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addPlugin($relObj->copy($deepCopy)); } } foreach ($this->getPropertys() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addProperty($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)); } } //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 Address (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->setZipcode($this->getZipcode()); $copyObj->setCity($this->getCity()); $copyObj->setState($this->getState()); $copyObj->setProvince($this->getProvince()); $copyObj->setCountry($this->getCountry()); $copyObj->setPhone($this->getPhone()); $copyObj->setFax($this->getFax()); $copyObj->setWebsite($this->getWebsite()); $copyObj->setEmail($this->getEmail()); $copyObj->setVatid($this->getVatid()); 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->getAccounts() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addAccount($relObj->copy($deepCopy)); } } foreach ($this->getDomains() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addDomain($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 } }