/** * Registers the student for the given career. * * @param Career $career * @param Orientation $orientation * @param integer $start_year */ public function registerToCareer(Career $career, Orientation $orientation = null, SubOrientation $sub_orientation = null, $start_year, $con = null) { if ($con == null) { $con = Propel::getConnection(StudentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $career_student = new CareerStudent(); $career_student->setCareerId($career->getId()); if ($orientation) { $career_student->setOrientationId($orientation->getId()); } if ($sub_orientation) { $career_student->setSubOrientationId($sub_orientation->getId()); } $career_student->setStudentId($this->getId()); $career_student->setStartYear($start_year); SchoolBehaviourFactory::getInstance()->setStudentFileNumberForCareer($career_student, $con); $career_student->save($con); SchoolBehaviourFactory::getInstance()->createStudentCareerSubjectAlloweds($career_student, $start_year, $con); }