/** * Checks whether there are events which need to be updated concerning a * given DB field. * * @param string $fieldToUpdate the DB field to check for needing an update, must be 'registrations' * * @return bool TRUE if any rows need to be updated, FALSE otherwise */ private function needsToUpdateEventField($fieldToUpdate) { switch ($fieldToUpdate) { case 'registrations': $whereClause = 'registrations = 0 AND EXISTS (' . 'SELECT * FROM tx_seminars_attendances' . ' WHERE seminar = tx_seminars_seminars.uid ' . tx_oelib_db::enableFields('tx_seminars_attendances') . ')'; break; default: throw new InvalidArgumentException('needsToUpdateEventField was called with "' . $fieldToUpdate . '", but the allowed value is only "registrations"', 1333291685); break; } return tx_oelib_db::count('tx_seminars_seminars', $whereClause) > 0; }