/** * @param KalturaBaseEntry $entry * @param entry $dbEntry * @return entry */ protected function prepareEntryForInsert(KalturaBaseEntry $entry, entry $dbEntry = null) { // create a default name if none was given if (!$entry->name) { $entry->name = $this->getPartnerId() . '_' . time(); } if ($entry->licenseType === null) { $entry->licenseType = KalturaLicenseType::UNKNOWN; } // first copy all the properties to the db entry, then we'll check for security stuff if (!$dbEntry) { $entryType = kPluginableEnumsManager::apiToCore('entryType', $entry->type); $class = entryPeer::getEntryClassByType($entryType); KalturaLog::debug("Creating new entry of API type [{$entry->type}] core type [{$entryType}] class [{$class}]"); $dbEntry = new $class(); } $dbEntry = $entry->toInsertableObject($dbEntry); $this->checkAndSetValidUserInsert($entry, $dbEntry); $this->checkAdminOnlyInsertProperties($entry); $this->validateAccessControlId($entry); $this->validateEntryScheduleDates($entry, $dbEntry); $dbEntry->setPartnerId($this->getPartnerId()); $dbEntry->setSubpId($this->getPartnerId() * 100); $dbEntry->setDefaultModerationStatus(); return $dbEntry; }