Пример #1
0
 /**
  *
  * @param PFUser $user
  * @param Tuleap\Tracker\REST\TrackerReference $tracker_reference
  * @param array $values
  * @return Tuleap\Tracker\REST\Artifact\ArtifactReference
  * @throws \Luracast\Restler\RestException
  */
 public function createWithValuesIndexedByFieldName(PFUser $user, Tuleap\Tracker\REST\TrackerReference $tracker_reference, array $values)
 {
     $tracker = $this->getTracker($tracker_reference);
     $fields_data = $this->artifact_validator->getFieldsDataOnCreateFromValuesByField($values, $tracker);
     $fields_data = $this->artifact_validator->getUsedFieldsWithDefaultValue($tracker, $fields_data, $user);
     $this->checkUserCanSubmit($user, $tracker);
     return $this->returnReferenceOrError($this->artifact_factory->createArtifact($tracker, $fields_data, $user, ''), 'by_field');
 }
Пример #2
0
 public function update(PFUser $user, Tracker_Artifact $artifact, array $values, Tuleap\Tracker\REST\ChangesetCommentRepresentation $comment = null)
 {
     $this->checkArtifact($user, $artifact);
     $fields_data = $this->artifact_validator->getFieldsDataOnUpdate($values, $artifact);
     $comment_body = '';
     $comment_format = Tracker_Artifact_Changeset_Comment::TEXT_COMMENT;
     if ($comment) {
         $comment_body = $comment->body;
         $comment_format = $comment->format;
     }
     $artifact->createNewChangeset($fields_data, $comment_body, $user, true, $comment_format);
 }