/** * Put children in a given milestone * * Put the new children of a given milestone. * * @url PUT {id}/milestones * * @param int $id Id of the milestone * @param array $ids Ids of the new milestones {@from body} * * @throws 400 * @throws 403 * @throws 404 */ protected function putSubmilestones($id, array $ids) { $user = $this->getCurrentUser(); $milestone = $this->getMilestoneById($user, $id); try { $this->milestone_validator->validateSubmilestonesFromBodyContent($ids, $milestone, $user); } catch (IdsFromBodyAreNotUniqueException $exception) { throw new RestException(400, $exception->getMessage()); } catch (SubMilestoneAlreadyHasAParentException $exception) { throw new RestException(400, $exception->getMessage()); } catch (ElementCannotBeSubmilestoneException $exception) { throw new RestException(400, $exception->getMessage()); } catch (UserCannotReadSubMilestoneException $exception) { throw new RestException(403, $exception->getMessage()); } catch (UserCannotReadSubMilestoneException $exception) { throw new RestException(403, $exception->getMessage()); } catch (SubMilestoneDoesNotExistException $exception) { throw new RestException(404, $exception->getMessage()); } try { $this->artifactlink_updater->update($ids, $milestone->getArtifact(), $user, new FilterValidSubmilestones($this->milestone_factory, $milestone)); } catch (ItemListedTwiceException $exception) { throw new RestException(400, $exception->getMessage()); } catch (Tracker_NoChangeException $exception) { //Do nothing } $this->sendAllowHeaderForSubmilestones(); }
/** * User want to update the content of a given milestone * * @param array $linked_artifact_ids The ids of the artifacts to link * @param PFUser $current_user The user who made the link * @param Planning_Milestone $milestone The milestone * */ public function updateMilestoneContent(array $linked_artifact_ids, PFUser $current_user, Planning_Milestone $milestone) { $this->artifactlink_updater->update($linked_artifact_ids, $milestone->getArtifact(), $current_user, new FilterValidContent($this->artifact_factory, $milestone)); }