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