public function executeRun() { $this->applicant = $this->applicant; $this->error = false; $this->regTestPeriod = RegTestPeriodPeer::retrieveByPK($this->applicant->getRegTestPeriod1()); if (!$this->regTestPeriod) { $this->success = true; $this->messageError = 'RegTestPeriod not found'; return false; } $testSubjectCriteria = new Criteria(); $testSubjectCriteria->add(TestSubjectPeer::DEPARTMENT_ID, $this->applicant->getDepartment1()); $testSubject = TestSubjectPeer::doSelect($testSubjectCriteria); $testSubjectCount = TestSubjectPeer::doCount($testSubjectCriteria); if ($testSubjectCount < 1) { $this->success = true; $this->messageError = 'Test Subject not found'; return false; } $testSubjectId = array(); foreach ($testSubject as $t) { $testSubjectId[] = $t->getId(); } $testScoreCriteria = new Criteria(); $testScoreCriteria->add(TestScorePeer::TEST_APPLICANT_ID, $this->applicant->getId(), Criteria::EQUAL); $testScoreCriteria->add(TestScorePeer::TEST_SUBJECT_ID, $testSubjectId, Criteria::IN); $testScoresTemp = TestScorePeer::doSelect($testScoreCriteria); $testScores = array(); foreach ($testScoresTemp as $t) { $testScores[$t->getTestSubjectId()] = $t; } $this->testSubject = $testSubject; $this->testSubjectCount = $testSubjectCount; $this->testScores = $testScores; }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(TestScorePeer::ID, $pks, Criteria::IN); $objs = TestScorePeer::doSelect($criteria, $con); } return $objs; }
public function getTestScores($criteria = null, $con = null) { include_once 'lib/model/om/BaseTestScorePeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collTestScores === null) { if ($this->isNew()) { $this->collTestScores = array(); } else { $criteria->add(TestScorePeer::TEST_APPLICANT_ID, $this->getId()); TestScorePeer::addSelectColumns($criteria); $this->collTestScores = TestScorePeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(TestScorePeer::TEST_APPLICANT_ID, $this->getId()); TestScorePeer::addSelectColumns($criteria); if (!isset($this->lastTestScoreCriteria) || !$this->lastTestScoreCriteria->equals($criteria)) { $this->collTestScores = TestScorePeer::doSelect($criteria, $con); } } } $this->lastTestScoreCriteria = $criteria; return $this->collTestScores; }