Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 37 lines (29 sloc) 0.941 kb
7c0c57c @beberlei Initial code
beberlei authored
1 <?php
2 // create_bug.php
3 require_once "bootstrap.php";
4
5 $theReporterId = $argv[1];
6 $theDefaultEngineerId = (isset($argv[2])) ? $argv[2] : 1;
7 $productIds = explode(",", $argv[3]);
8
9 $reporter = $entityManager->find("User", $theReporterId);
10 $engineer = $entityManager->find("User", $theDefaultEngineerId);
11 if (!$reporter || !$engineer) {
12 echo "No reporter and/or engineer found for the input.\n";
13 exit(1);
14 }
15
16 $bug = new Bug();
17 $bug->setDescription("Something does not work!");
18 $bug->setCreated(new DateTime("now"));
19 $bug->setStatus("OPEN");
20
21 foreach ($productIds AS $productId) {
22 $product = $entityManager->find("Product", $productId);
f6735b7 @ayaya1024 Exit if product id is invalid
ayaya1024 authored
23 if (!$product) {
24 echo "No product found for the input.\n";
25 exit(1);
26 }
7c0c57c @beberlei Initial code
beberlei authored
27 $bug->assignToProduct($product);
28 }
29
30 $bug->setReporter($reporter);
31 $bug->setEngineer($engineer);
32
33 $entityManager->persist($bug);
34 $entityManager->flush();
35
36 echo "Your new Bug Id: ".$bug->getId()."\n";
Something went wrong with that request. Please try again.