private function _buildFileSelectionFilter($submissionId, $fileStage, $fileId, $revision, $assocType, $assocId, $stageId, $uploaderUserId, $uploaderUserGroupId, $reviewRoundId)
{
// Make sure that at least one entity filter has been set.
assert($submissionId > 0 || (int) $uploaderUserId || (int) $fileId || (int) $assocId);
// Both, assoc type and id, must be set (or unset) together.
assert((int) $assocType && (int) $assocId || !((int) $assocType || (int) $assocId));
// Collect the filtered columns and ids in
// an array for consistent handling.
$filters = array('sf.submission_id' => $submissionId, 'sf.file_stage' => $fileStage, 'sf.file_id' => $fileId, 'sf.revision' => $revision, 'sf.assoc_type' => $assocType, 'sf.assoc_id' => $assocId, 'sf.uploader_user_id' => $uploaderUserId, 'sf.user_group_id' => $uploaderUserGroupId, 'rrf.stage_id' => $stageId, 'rrf.review_round_id' => $reviewRoundId);
// Build and return a SQL where clause and a parameter
// array.
$filterClause = '';
$params = array();
$conjunction = '';
foreach ($filters as $filteredColumn => $filteredId) {
if ($filteredId) {
$filterClause .= $conjunction . ' ' . $filteredColumn . ' = ?';
$conjunction = ' AND';
$params[] = (int) $filteredId;
}
}
return array($filterClause, $params);
}