do a uniqueness check before saving new notice-to-status mapping

This commit is contained in:
Evan Prodromou 2010-09-05 00:05:11 -04:00
parent f8a4a8f5ba
commit 0a5e1f2d88

View File

@ -153,6 +153,18 @@ class Notice_to_status extends Memcached_DataObject
static function saveNew($notice_id, $status_id)
{
$n2s = Notice_to_status::staticGet('notice_id', $notice_id);
if (!empty($n2s)) {
return $n2s;
}
$n2s = Notice_to_status::staticGet('status_id', $status_id);
if (!empty($n2s)) {
return $n2s;
}
$n2s = new Notice_to_status();
$n2s->notice_id = $notice_id;