/** * 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 Course (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->setId($this->id); $copyObj->setDeptId($this->dept_id); $copyObj->setDescr($this->descr); $copyObj->setIsEng($this->is_eng); 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->getCourseComments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCourseComment($relObj->copy($deepCopy)); } } foreach ($this->getCourseDetails() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCourseDetail($relObj->copy($deepCopy)); } } foreach ($this->getCourseInstructorAssociations() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCourseInstructorAssociation($relObj->copy($deepCopy)); } } foreach ($this->getCourseDisciplineAssociations() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCourseDisciplineAssociation($relObj->copy($deepCopy)); } } foreach ($this->getExams() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addExam($relObj->copy($deepCopy)); } } } // if ($deepCopy) $copyObj->setNew(true); }
/** * 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. * @throws PropelException */ public function copyInto($copyObj, $deepCopy = false) { $copyObj->setUserName($this->user_name); $copyObj->setPassword($this->password); $copyObj->setTypeId($this->type_id); $copyObj->setEmail($this->email); $copyObj->setRegisteredOn($this->registered_on); 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->getCourseComments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCourseComment($relObj->copy($deepCopy)); } } foreach ($this->getCourseRatings() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addCourseRating($relObj->copy($deepCopy)); } } foreach ($this->getExamComments() as $relObj) { if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves $copyObj->addExamComment($relObj->copy($deepCopy)); } } } // if ($deepCopy) $copyObj->setNew(true); $copyObj->setId(NULL); // this is a auto-increment column, so set to default value }