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