public function put(PFUser $user, Project $project, array $ids)
 {
     $this->checkIfUserCanChangePrioritiesInMilestone($user, $project);
     $this->validateArtifactIdsAreInUnassignedTopBacklog($ids, $user, $project);
     try {
         $this->artifactlink_updater->setOrderWithHistoryChangeLogging($ids, self::TOP_BACKLOG_IDENTIFIER, $project->getId());
     } catch (ItemListedTwiceException $exception) {
         throw new RestException(400, $exception->getMessage());
     }
     $this->sendAllowHeaders();
 }
예제 #2
0
 /**
  * Update backlog items priorities
  *
  * The array of ids given as argument will:
  * <ul>
  *  <li>update the priorities according to order in given array</li>
  * </ul>
  * <br />
  * <strong>WARNING:</strong> PUT will NOT add/remove element in backlog.
  * Remove from backlog doesn't make sense but add might be useful to deal
  * with inconsistent items. You can have a look at PATCH {id}/backlog for
  * add.
  *
  * @url PUT {id}/backlog
  *
  * @param int   $id  Id of the milestone
  * @param array $ids Ids of backlog items {@from body}{@type int}
  *
  * @throw 400
  * @throw 403
  * @throw 404
  */
 protected function putBacklog($id, array $ids)
 {
     $user = $this->getCurrentUser();
     $milestone = $this->getMilestoneById($user, $id);
     $this->checkIfUserCanChangePrioritiesInMilestone($milestone, $user);
     try {
         $this->milestone_validator->validateArtifactIdsAreInUnplannedMilestone($ids, $milestone, $user);
     } catch (ArtifactIsNotInUnplannedBacklogItemsException $exception) {
         throw new RestException(404, $exception->getMessage());
     } catch (IdsFromBodyAreNotUniqueException $exception) {
         throw new RestException(400, $exception->getMessage());
     }
     try {
         $this->artifactlink_updater->setOrderWithHistoryChangeLogging($ids, $id, $milestone->getProject()->getId());
     } catch (ItemListedTwiceException $exception) {
         throw new RestException(400, $exception->getMessage());
     }
     $this->sendAllowHeaderForBacklog();
 }