* 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here.
*/
* 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here.
*/
static function ensureTally($noticeID)
{
$tally = Fave_tally::staticGet('notice_id', $noticeID);
if (!$tally) {
static function ensureTally($noticeID)
{
$tally = Fave_tally::staticGet('notice_id', $noticeID);
if (!$tally) {
$tally = new Fave_tally();
$tally->notice_id = $noticeID;
$tally->count = Fave_tally::countExistingFaves($noticeID);
$result = $tally->insert();
if (!$result) {
$msg = sprintf(
$tally = new Fave_tally();
$tally->notice_id = $noticeID;
$tally->count = Fave_tally::countExistingFaves($noticeID);
$result = $tally->insert();
if (!$result) {
$msg = sprintf(