Exemplo n.º 1
0
 public static function incPlaysIfExists($kshow_id, $entry_id)
 {
     $entry_id = self::getKshowEntryId($kshow_id, $entry_id);
     $c = new Criteria();
     $c->add(WidgetLogPeer::ENTRY_ID, $entry_id);
     $c->add(WidgetLogPeer::KSHOW_ID, $kshow_id);
     $c->addAscendingOrderByColumn(WidgetLogPeer::ID);
     // the first found will always stay the first found
     $widget_log = WidgetLogPeer::doSelectOne($c);
     // update the statistics of the first existing widget_log
     if ($widget_log) {
         $widget_log->setPlays($widget_log->getPlays() + 1);
         $widget_log->save();
     } else {
         // if does not exist - do nothing.
         // there is no use incrementing the plays if the widget was never created
     }
 }