/** * Allows you to add a short link object * * @action add * @param KalturaShortLink $shortLink * @return KalturaShortLink */ function addAction(KalturaShortLink $shortLink) { $shortLink->validatePropertyNotNull('systemName'); $shortLink->validatePropertyMinLength('systemName', 3); $shortLink->validatePropertyNotNull('fullUrl'); $shortLink->validatePropertyMinLength('fullUrl', 10); if (!$shortLink->status) { $shortLink->status = KalturaShortLinkStatus::ENABLED; } if (!$shortLink->userId) { $shortLink->userId = $this->getKuser()->getPuserId(); } $dbShortLink = new ShortLink(); $dbShortLink = $shortLink->toInsertableObject($dbShortLink, array('userId')); $dbShortLink->setPartnerId($this->getPartnerId()); $dbShortLink->setPuserId(is_null($shortLink->userId) ? $this->getKuser()->getPuserId() : $shortLink->userId); $dbShortLink->save(); $shortLink = new KalturaShortLink(); $shortLink->fromObject($dbShortLink); return $shortLink; }