JiraRestApi\Issue\IssueService::addAttachments PHP Метод

addAttachments() публичный Метод

Add one or more file to an issue.
public addAttachments ( $issueIdOrKey, $filePathArray )
    public function addAttachments($issueIdOrKey, $filePathArray)
    {
        $results = $this->upload($this->uri . "/{$issueIdOrKey}/attachments", $filePathArray);
        $this->log->addInfo('addAttachments result=' . var_export($results, true));
        $resArr = array();
        foreach ($results as $ret) {
            array_push($resArr, $this->json_mapper->mapArray(json_decode($ret), new \ArrayObject(), '\\JiraRestApi\\Issue\\Attachment'));
        }
        return $resArr;
    }

Usage Example

 /**
  * @depends testCreateIssue
  */
 public function testAddAttachment($issueKey)
 {
     try {
         $issueService = new IssueService();
         $ret = $issueService->addAttachments($issueKey, array('screen_capture.png', 'bug-description.pdf', 'README.md'));
         print_r($ret);
         return $issueKey;
     } catch (JIRAException $e) {
         $this->assertTrue(false, 'Attach Failed : ' . $e->getMessage());
     }
 }