コード例 #1
0
ファイル: ActivityRepository.php プロジェクト: neblion/scrum
 public function loadForProject(\Neblion\ScrumBundle\Entity\Project $project, $returnQuery = false, $max = 8)
 {
     $query = $this->getEntityManager()->createQuery('SELECT a, p, ac, pr 
                 FROM NeblionScrumBundle:Activity a
                 INNER JOIN a.project p
                 INNER JOIN a.account ac
                 INNER JOIN ac.profile pr
                 WHERE p.id = :project_id
                 ORDER BY a.created DESC')->setParameter('project_id', $project->getId());
     if ($returnQuery) {
         return $query;
     }
     return $query->setMaxResults($max)->getResult();
 }
コード例 #2
0
ファイル: LoadProjectData.php プロジェクト: neblion/scrum
 private function newEntity($params)
 {
     // Create project
     $entity = new Project();
     $entity->setName($params['name']);
     $entity->setDescription($params['description']);
     $entity->setSprintStartDay($params['sprint_start_day']);
     $entity->setSprintDuration($params['sprint_duration']);
     $this->manager->persist($entity);
     // Create default release
     $releaseStatus = $this->manager->getRepository('NeblionScrumBundle:ProcessStatus')->find(3);
     $release = new ProjectRelease();
     $release->setProject($entity);
     $release->setName('Default');
     $release->setDescription('Default release');
     $release->setStart(new \DateTime('2012-09-01'));
     $release->setEnd(new \DateTime('2012-10-02'));
     $release->setStatus($releaseStatus);
     $this->manager->persist($release);
     // Create default feature
     $feature = new Feature();
     $feature->setProject($entity);
     $feature->setName('Default');
     $feature->setDescription('Default feature');
     $feature->setColor('#ffffff');
     $this->manager->persist($feature);
 }
コード例 #3
0
ファイル: ProjectRepository.php プロジェクト: neblion/scrum
 /**
  * getDataBurnUpPoints
  * 
  * Get number of points total/done per release/sprint
  * 
  * @param \Neblion\ScrumBundle\Entity\Project $project
  * @return type 
  */
 public function getDataBurnUpPoints(\Neblion\ScrumBundle\Entity\Project $project)
 {
     // Initialisation
     $response = array();
     $datas = array(0 => array('total' => 0, 'done' => 0));
     $ticks = array(0 => 'R0S0');
     $releaseIndex = $sprintIndex = $index = 1;
     $total = $done = 0;
     // Query
     $results = $this->getEntityManager()->createQuery('SELECT p, pr, sp, st, sts
                 FROM NeblionScrumBundle:Project p
                 INNER JOIN p.releases pr
                 INNER JOIN pr.sprints sp
                 INNER JOIN sp.stories st
                 INNER JOIN st.status sts
                 WHERE p.id = :id
                 ORDER BY pr.start, sp.start')->setParameter('id', $project->getId())->getArrayResult();
     if (!empty($results)) {
         foreach ($results[0]['releases'] as $release) {
             foreach ($release['sprints'] as $sprint) {
                 // Initialisation
                 $ticks[$index] = 'R' . $releaseIndex . 'S' . $sprintIndex;
                 foreach ($sprint['stories'] as $story) {
                     if ($story['status']['id'] == 3) {
                         $done += $story['estimate'];
                     }
                     $total += $story['estimate'];
                 }
                 $datas[$index]['total'] = $total;
                 $datas[$index]['done'] = $done;
                 $sprintIndex++;
                 $index++;
             }
             $releaseIndex++;
             $sprintIndex = 1;
         }
     }
     return $reponse = array('data' => $datas, 'ticks' => $ticks);
 }