/** * Sets KnowledgebaseArticle. * * @param kyKnowledgebaseArticle $kbarticle kbarticle item. * @return kyKnowledgebaseComment */ public function setKbarticle($kbarticle) { $this->kbarticle = ky_assure_object($kbarticle, 'kyKnowledgebaseArticle'); $this->kbarticle_id = $this->kbarticle !== null ? $this->kbarticle->getId() : null; return $this; }
/** * Creates new attachment for kbarticle with contents provided as parameter. * WARNING: Data is not sent to Kayako unless you explicitly call create() on this method's result. * * @param kyKnowledgebaseArticle $kbarticle knowledgebase article. * @param string $contents Raw contents of the file. * @param string $file_name Filename. * @return kyKnowledgebaseAttachment */ public static function createNew($kbarticle, $contents, $file_name) { $new_kbarticle_attachment = new kyKnowledgebaseAttachment(); $new_kbarticle_attachment->setKbarticleId($kbarticle->getId()); $new_kbarticle_attachment->setContents($contents); $new_kbarticle_attachment->setFileName($file_name); return $new_kbarticle_attachment; }