commit feb3b00de534e972221397dfb5a80c93de8b77f7 parent 0594b4f2c55c84dfbd55f7cbbbcd6441100824f0 Author: Felicitus <felicitus@felicitus.org> Date: Sat, 7 Nov 2015 16:57:09 +0100 Added phpdoc Diffstat:
M | src/PartKeepr/StatisticBundle/Services/StatisticService.php | | | 19 | +++++++++++++++++-- |
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/PartKeepr/StatisticBundle/Services/StatisticService.php b/src/PartKeepr/StatisticBundle/Services/StatisticService.php @@ -15,17 +15,28 @@ class StatisticService $this->entityManager = $entityManager; } - public function getPartCount($withPrice = false) + /** + * Returns the part count + * + * @param bool|false $withoutPrice Set to true to retrieve all parts where the average price is null + * + * @return mixed + */ + public function getPartCount($withoutPrice = false) { $dql = "SELECT COUNT(p.id) FROM PartKeepr\PartBundle\Entity\Part p"; - if ($withPrice === true) { + if ($withoutPrice === true) { $dql .= " WHERE p.averagePrice IS NOT NULL"; } return $this->entityManager->createQuery($dql)->getSingleScalarResult(); } + /** + * Returns the part category count + * @return int + */ public function getPartCategoryCount() { $dql = "SELECT COUNT(c.id) FROM PartKeepr\PartBundle\Entity\PartCategory c"; @@ -57,6 +68,10 @@ class StatisticService return $this->entityManager->createQuery($dql)->getSingleScalarResult(); } + /** + * Returns the part counts per part unit + * @return array An array of arrays with the keys "name" and "stockLevel" + */ public function getUnitCounts() { $dql = 'SELECT SUM(p.stockLevel) AS stockLevel, pu.name AS name FROM ';