Permalink
Switch branches/tags
Nothing to show
Find file
f6735b7 Mar 20, 2014
@ayaya1024 @beberlei
37 lines (29 sloc) 941 Bytes
<?php
// create_bug.php
require_once "bootstrap.php";
$theReporterId = $argv[1];
$theDefaultEngineerId = (isset($argv[2])) ? $argv[2] : 1;
$productIds = explode(",", $argv[3]);
$reporter = $entityManager->find("User", $theReporterId);
$engineer = $entityManager->find("User", $theDefaultEngineerId);
if (!$reporter || !$engineer) {
echo "No reporter and/or engineer found for the input.\n";
exit(1);
}
$bug = new Bug();
$bug->setDescription("Something does not work!");
$bug->setCreated(new DateTime("now"));
$bug->setStatus("OPEN");
foreach ($productIds AS $productId) {
$product = $entityManager->find("Product", $productId);
if (!$product) {
echo "No product found for the input.\n";
exit(1);
}
$bug->assignToProduct($product);
}
$bug->setReporter($reporter);
$bug->setEngineer($engineer);
$entityManager->persist($bug);
$entityManager->flush();
echo "Your new Bug Id: ".$bug->getId()."\n";