Exemplo n.º 1
0
 /**
  * Makes new Issue Object and sets the values from the raw data in JiraClient
  * @param $data
  * @return issue
  */
 public static function buildIssueFromArray($data)
 {
     $issue = new Issue();
     if (!$data == null && !array_key_exists(['errorMessages'][0], $data)) {
         if (!array_key_exists(['issues'][0], $data)) {
             throw new Exception('Please add an issue with custom fields to set a start date of the project.');
         } else {
             $issue->setStartDate($data['issues'][0]['fields']['customfield_10010']);
         }
         if (!array_key_exists(['issues'][0], $data)) {
             throw new Exception('Please add an issue with custom fields to set a end date of the project.');
         } else {
             $issue->setEndDate($data['issues'][0]['fields']['customfield_10011']);
         }
     } else {
         throw new Exception('Error message: ' . $data['errorMessages'][0] . " The JQL Url in parameters.yml isn't set correctly", 500);
     }
     return $issue;
 }
Exemplo n.º 2
0
 public function load(ObjectManager $manager)
 {
     $admin = $this->getReference('user_admin');
     $userManager = $this->getReference('user_manager');
     $operator = $this->getReference('user_operator');
     $issue = new Issue();
     $issue->setReporter($admin)->setAssignee($admin)->setProject($this->getReference('project_one'))->setSummary('First task for admin')->setCode('task-one')->setDescription('Some test describe words for first task')->setType(EnumTypeIssue::TASK)->setPriority(EnumPriorityIssue::MINOR)->setStatus(EnumStatusIssue::OPEN);
     $manager->persist($issue);
     $issueTwo = new Issue();
     $issueTwo->setReporter($admin)->setAssignee($userManager)->setProject($this->getReference('project_two'))->setSummary('Second task for admin')->setCode('task-two')->setDescription('Some test describe words for second task')->setType(EnumTypeIssue::STORY)->setPriority(EnumPriorityIssue::CRITICAL)->setStatus(EnumStatusIssue::OPEN);
     $manager->persist($issueTwo);
     $issueThree = new Issue();
     $issueThree->setReporter($admin)->setAssignee($operator)->setProject($this->getReference('project_three'))->setSummary('Third task for admin')->setCode('task-three')->setDescription('Some test describe words for task number three')->setType(EnumTypeIssue::BUG)->setPriority(EnumPriorityIssue::MAJOR)->setStatus(EnumStatusIssue::OPEN);
     $manager->persist($issueThree);
     $manager->flush();
     $this->addReference('issue_one', $issue);
     $this->addReference('issue_two', $issueTwo);
     $this->addReference('issue_three', $issueThree);
 }
 /**
  * @Route("/notebook/issues/createIssue/", name="issuesCreateIssue")
  * @Method("POST")
  */
 public function createIssueAction(Request $request)
 {
     $project = $request->request->get('project');
     $folder = $request->request->get('folder');
     $date = new \DateTime("now");
     $user = $this->get('security.token_storage')->getToken()->getUser();
     $userId = $user->getId();
     $issuesResult = $this->getDoctrine()->getRepository('AppBundle:Issue')->findBy(array('userId' => $userId), array('userSpecificId' => 'DESC'));
     if ($issuesResult) {
         $nextSpecificId = $issuesResult[0]->getUserSpecificId() + 1;
     } else {
         $nextSpecificId = 1;
     }
     $issue = new Issue();
     $issue->setUserId($userId);
     $issue->setUserSpecificId($nextSpecificId);
     $issue->setDateCreated($date);
     $issue->setDateModified($date);
     $issue->setTitle("");
     $issue->setDescription("");
     $issue->setIsCompleted(false);
     $issue->setLabels("");
     $issue->setProject($project);
     $issue->setFolder($folder);
     $em = $this->getDoctrine()->getManager();
     $em->persist($issue);
     $em->flush();
     $viewUrl = $this->generateUrl("singleIssue", array('id' => $issue->getId()));
     $response = new JsonResponse(array('id' => $issue->getId(), 'itemId' => $issue->getUserSpecificId(), 'project' => $issue->getProject(), 'folder' => $issue->getFolder(), 'viewUrl' => $viewUrl));
     return $response;
 }
Exemplo n.º 4
0
 /**
  * Creates a form to delete a Issue entity.
  *
  * @param Issue $issue The Issue entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Issue $issue)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('issue_delete', array('id' => $issue->getId())))->setMethod('DELETE')->getForm();
 }
 /**
  * @Route("/{issue}/comment/new", name="issue_new_comment")
  * @ParamConverter("issue", class="AppBundle:Issue", options={"repository_method" = "findOneByCode"})
  * @Security("is_granted('create', issue)")
  * @Template("AppBundle:Issue:edit.html.twig")
  */
 public function newCommentAction(Issue $issue)
 {
     $comment = new Comment();
     $form = $this->createForm('app_issue_comment', $comment, ['action' => $this->generateUrl('issue_new_comment', ['issue' => $issue->getCode()]), 'method' => 'POST']);
     if ($this->get('request')->getMethod() === 'POST') {
         $form->handleRequest($this->get('request'));
         if ($form->isValid()) {
             $user = $this->getUser();
             $comment->setAuthor($user);
             $comment->setIssue($issue);
             $issue->addComment($comment);
             $entityManager = $this->getDoctrine()->getManager();
             $entityManager->persist($comment);
             $entityManager->flush();
             return $this->redirect($this->generateUrl('issue_show', ['issue' => $issue->getCode()]));
         }
     }
     return ['entity' => $comment->getIssue(), 'form' => $form->createView()];
 }
 public function findByIssue(Issue $issue)
 {
     $query = $this->createQueryBuilder('activity');
     $query->leftJoin('activity.project', 'p')->leftJoin('activity.issue', 'i')->leftJoin('activity.user', 'u')->where('i.id = :issue_id')->setParameter('issue_id', $issue->getId())->orderBy('activity.created', 'DESC')->setMaxResults(16);
     return $query->getQuery()->getResult();
 }