public function doSave($con = null)
 {
     parent::doSave($con);
     $student = StudentPeer::retrieveByPk($this->getValue('student_id'));
     $career_school_year_period = CareerSchoolYearPeriodPeer::retrieveByPk($this->getValue('career_school_year_period_id'));
     $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $career_school_year_period->getCareerSchoolYear());
     $course_subject = CourseSubjectPeer::retrieveByPk($this->getValue('course_subject_id'));
     $student_free = StudentFreePeer::retrieveByStudentCareerSchoolYearCareerSchoolYearPeriodAndCourse($student_career_school_year, $career_school_year_period, $course_subject);
     $student_free->setIsFree(false);
     $student_free->save($con);
 }
 /**
  * This method check if exists a student_free with the parameters.
  * IF NOT exists then the student inst free, otherwise check the value of the student_free
  *
  * @see StudentPeer::retrieveByStudentCarreerSchoolyearPeriodAndCourse
  *
  * @param Student $student
  * @param CareerSchoolYearPeriod $career_school_year_period
  * @param type $course_subject
  *
  * @return boolean
  */
 public function isFreeStudent(Student $student, CareerSchoolYearPeriod $career_school_year_period = null, CourseSubject $course_subject = null, CareerSchoolYear $career_school_year)
 {
     $student_career_school_year = StudentCareerSchoolYearPeer::getCurrentForStudentAndCareerSchoolYear($student, $career_school_year);
     $student_free = StudentFreePeer::retrieveByStudentCareerSchoolYearCareerSchoolYearPeriodAndCourse($student_career_school_year, $career_school_year_period, $course_subject);
     return is_null($student_free) ? false : $student_free->getIsFree();
 }