public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $entry_id = $this->getPM("entry_id"); $detailed = $this->getP("detailed", false); $entry = null; if ($entry_id) { $entry = entryPeer::retrieveByPK($entry_id); } if (!$entry) { $this->addError(APIErrors::INVALID_ENTRY_ID, $entry_id); } else { $kshow_id = $entry->getKshowId(); $kshow = $entry->getKshow(); if (!$kshow) { $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id); } else { $newKshow = myKshowUtils::shalowCloneById($kshow_id, $puser_kuser->getKuserId()); if (!$newKshow) { $this->addError(APIErrors::KSHOW_CLONE_FAILED, $kshow_id); } else { $newEntry = $newKshow->getShowEntry(); $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR; $wrapper = objectWrapperBase::getWrapperClass($newEntry, $level); // TODO - remove this code when cache works properly when saving objects (in their save method) $wrapper->removeFromCache("entry", $newEntry->getId()); $this->addMsg("entry", $wrapper); } } } }
/** * Clones an existing mix. * * @action clone * @param string $entryId Mix entry id to clone * @return KalturaMixEntry The new mix entry */ function cloneAction($entryId) { $dbEntry = entryPeer::retrieveByPK($entryId); if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::MIX) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $kshowId = $dbEntry->getKshowId(); $kshow = $dbEntry->getKshow(); if (!$kshow) { KalturaLog::CRIT("Kshow was not found for mix id [" . $entryId . "]"); throw new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR); } $newKshow = myKshowUtils::shalowCloneById($kshowId, $this->getKuser()->getId()); if (!$newKshow) { KalturaLog::ERR("Failed to clone kshow for mix id [" . $entryId . "]"); throw new KalturaAPIException(KalturaErrors::INTERNAL_SERVERL_ERROR); } $newEntry = $newKshow->getShowEntry(); $newMixEntry = new KalturaMixEntry(); $newMixEntry->fromObject($newEntry); myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $newEntry); return $newMixEntry; }