示例#1
0
 /**
  * @action unlike
  * Action for current kuser to revoke a previously added "like" from an entry
  * @param string $entryId
  * @return bool
  */
 public function unlikeAction($entryId)
 {
     if (!$entryId) {
         throw new KalturaAPIException(KalturaErrors::MISSING_MANDATORY_PARAMETER, "entryId");
     }
     $existingKVote = kvotePeer::doSelectByEntryIdAndPuserId($entryId, $this->getPartnerId(), kCurrentContext::$ks_uid);
     if (!$existingKVote) {
         throw new KalturaAPIException(KalturaLikeErrors::USER_LIKE_FOR_ENTRY_NOT_FOUND);
     }
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     if (kvotePeer::disableExistingKVote($entryId, $this->getPartnerId(), kCurrentContext::$ks_uid)) {
         return true;
     }
     return false;
 }