@@ 45-64 (lines=20) @@ | ||
42 | ->getResult(); |
|
43 | } |
|
44 | ||
45 | public function findSubactivityByYearSectorAndActivity($year, $sector, $activity) |
|
46 | { |
|
47 | $dql = 'SELECT sa.id as subactivity, |
|
48 | sa.name, |
|
49 | SUM(e.value) as total |
|
50 | FROM Api\Entity\Emission e |
|
51 | INNER JOIN e.subactivity sa |
|
52 | WHERE e.value > 0 |
|
53 | AND e.sector = :sector |
|
54 | AND e.activity = :activity |
|
55 | AND e.year = :year |
|
56 | GROUP BY e.subactivity |
|
57 | ORDER BY sa.name'; |
|
58 | ||
59 | return $this->getEntityManager()->createQuery($dql) |
|
60 | ->setParameter('year', $year) |
|
61 | ->setParameter('sector', $sector) |
|
62 | ->setParameter('activity', $activity) |
|
63 | ->getResult(); |
|
64 | } |
|
65 | ||
66 | public function findCategoryByYearSectorActivityAndSubactivity($year, $sector, $activity, $subactivity) |
|
67 | { |
|
@@ 66-87 (lines=22) @@ | ||
63 | ->getResult(); |
|
64 | } |
|
65 | ||
66 | public function findCategoryByYearSectorActivityAndSubactivity($year, $sector, $activity, $subactivity) |
|
67 | { |
|
68 | $dql = 'SELECT c.id as category, |
|
69 | c.name, |
|
70 | SUM(e.value) as total |
|
71 | FROM Api\Entity\Emission e |
|
72 | INNER JOIN e.category c |
|
73 | WHERE e.value > 0 |
|
74 | AND e.sector = :sector |
|
75 | AND e.activity = :activity |
|
76 | AND e.subactivity = :subactivity |
|
77 | AND e.year = :year |
|
78 | GROUP BY e.category |
|
79 | ORDER BY c.name'; |
|
80 | ||
81 | return $this->getEntityManager()->createQuery($dql) |
|
82 | ->setParameter('year', $year) |
|
83 | ->setParameter('sector', $sector) |
|
84 | ->setParameter('activity', $activity) |
|
85 | ->setParameter('subactivity', $subactivity) |
|
86 | ->getResult(); |
|
87 | } |
|
88 | ||
89 | public function findGasesByYear($year) |
|
90 | { |