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(ClassCounselPeer::COUNT_DISTINCT); } else { $criteria->addSelectColumn(ClassCounselPeer::COUNT); } foreach ($criteria->getGroupByColumns() as $column) { $criteria->addSelectColumn($column); } $criteria->addJoin(ClassCounselPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID); $criteria->addJoin(ClassCounselPeer::STUDENT_ID, StudentPeer::ID); $criteria->addJoin(ClassCounselPeer::COUNSELING_STATUS_ID, CounselingStatusPeer::ID); $criteria->addJoin(ClassCounselPeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $rs = ClassCounselPeer::doSelectRS($criteria, $con); if ($rs->next()) { return $rs->getInt(1); } else { return 0; } }