public static function resetReferendum($electionId, $bannerId) { $referendumIds = Election::getReferendumIds($electionId); if (empty($referendumIds)) { return; } $db = \phpws2\Database::getDB(); $tbl = $db->addTable('elect_referendum_vote'); foreach ($referendumIds as $var) { $id = $var['id']; $hash = StudentFactory::getVoteHash($id, $bannerId); $tbl->addFieldConditional('voterHash', $hash); $tbl->addFieldConditional('referendumId', $id); $tbl->addFieldConditional('electionId', $electionId); $db->delete(); $db->clearConditional(); } }