public function createLastYearCommissions() { $last_year_school_year = SchoolYearPeer::retrieveLastYearSchoolYear($this->getSchoolYear()); $last_year_career_school_year = CareerSchoolYearPeer::retrieveByCareerAndSchoolYear($this->getCareer(), $last_year_school_year); SchoolYearPeer::clearInstancePool(); CareerSchoolYearPeer::clearInstancePool(); $con = Propel::getConnection(); try { $con->beginTransaction(); $commissions = CoursePeer::retrieveComissionsForCareerSchoolYear($last_year_career_school_year); foreach ($commissions as $commission) { $commission->createCopyForSchoolYear($con, null, $this); $commission->clearAllReferences(true); unset($commission); } unset($commissions); $con->commit(); } catch (PropelException $e) { $con->rollback(); throw $e; } }