FeedbackRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 1
c 3
b 0
f 2
lcom 0
cbo 4
dl 0
loc 19
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A countPerStatus() 0 11 1
1
<?php
2
3
namespace Developtech\AgilityBundle\Repository;
4
5
use Developtech\AgilityBundle\Model\ProjectModel;
6
7
use Developtech\AgilityBundle\Entity\Job;
8
9
/**
10
 * FeedbackRepository
11
 *
12
 * This class was generated by the Doctrine ORM. Add your own custom
13
 * repository methods below.
14
 */
15
class FeedbackRepository extends \Doctrine\ORM\EntityRepository
16
{
17
    /**
18
     * @param ProjectModel $project
19
     * @param integer $status
20
     * @return integer
21
     */
22 1
    public function countPerStatus(ProjectModel $project, $status) {
23 1
        $statement = $this->getEntityManager()->getConnection()->prepare(
24 1
            "SELECT COUNT(*) as nb_feedbacks FROM {$this->getEntityManager()->getClassMetadata(Job::class)->getTableName()} " .
25 1
            "WHERE project_id = :project_id AND status = :status AND type = '" . Job::TYPE_FEEDBACK . "'"
26 1
        );
27 1
        $statement->execute([
28 1
            'project_id' => $project->getId(),
29
            'status' => $status
30 1
        ]);
31 1
        return (int) $statement->fetch()['nb_feedbacks'];
32
    }
33
}
34