public static function doCountJoinAllExceptTestSchedule(Criteria $criteria, $distinct = false, $con = null) { $criteria = clone $criteria; $criteria->clearSelectColumns()->clearOrderByColumns(); if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { $criteria->addSelectColumn(TestGradePeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(TestGradePeer::COUNT); } foreach ($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } $criteria->addJoin(TestGradePeer::TEST_APPLICANT_ID, TestApplicantPeer::ID); $rs = TestGradePeer::doSelectRS($criteria, $con); if ($rs->next()) { return $rs->getInt(1); } else { return 0; } }