Beispiel #1
0
 /**
  * Update exisiting widget
  * 
  * @action update
  * @param string $id 
  * @param KalturaWidget $widget
  * @return KalturaWidget
  */
 function updateAction($id, KalturaWidget $widget)
 {
     $dbWidget = widgetPeer::retrieveByPK($id);
     if (!$dbWidget) {
         throw new KalturaAPIException(APIErrors::INVALID_WIDGET_ID, $id);
     }
     $widgetUpdate = $widget->toWidget();
     $allow_empty = true;
     // TODO - what is the policy  ?
     baseObjectUtils::autoFillObjectFromObject($widgetUpdate, $dbWidget, $allow_empty);
     $dbWidget->save();
     // TODO: widget in cache, should drop from cache
     $widget->fromWidget($dbWidget);
     return $widget;
 }
Beispiel #2
0
 /**
  * Update exisiting widget
  * 
  * @action update
  * @param string $id 
  * @param KalturaWidget $widget
  * @return KalturaWidget
  */
 function updateAction($id, KalturaWidget $widget)
 {
     $dbWidget = widgetPeer::retrieveByPK($id);
     if (!$dbWidget) {
         throw new KalturaAPIException(APIErrors::INVALID_WIDGET_ID, $id);
     }
     if (!is_null($widget->enforceEntitlement) && $widget->enforceEntitlement == false && kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DISABLE_ENTITLEMENT_FOR_WIDGET_WHEN_ENTITLEMENT_ENFORCEMENT_ENABLE);
     }
     if ($widget->entryId !== null) {
         $entry = entryPeer::retrieveByPK($widget->entryId);
         if (!$entry) {
             throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $widget->entryId);
         }
     } elseif ($widget->enforceEntitlement != null && $widget->enforceEntitlement == false) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DISABLE_ENTITLEMENT_WITH_NO_ENTRY_ID);
     }
     $widgetUpdate = $widget->toWidget();
     if ($entry && $entry->getType() == entryType::PLAYLIST) {
         $dbWidget->setIsPlayList(true);
     } else {
         $dbWidget->setIsPlayList(false);
     }
     $allow_empty = true;
     // TODO - what is the policy  ?
     baseObjectUtils::autoFillObjectFromObject($widgetUpdate, $dbWidget, $allow_empty);
     $dbWidget->save();
     // TODO: widget in cache, should drop from cache
     $widget->fromObject($dbWidget, $this->getResponseProfile());
     return $widget;
 }