AccountRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A findAllUserArchived() 0 10 1
1
<?php
2
3
namespace PiouPiou\RibsAdminBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use PiouPiou\RibsAdminBundle\Entity\User;
7
8
class AccountRepository extends EntityRepository
9
{
10
    /**
11
     * function that return a list of all users that are not archived and different of current account
12
     * @param User $current_account
13
     * @param bool $archived
14
     * @return array
15
     */
16
    public function findAllUserArchived(User $current_account, bool $archived = false): array
17
    {
18
        $query = $this->getEntityManager()->createQuery("SELECT fu FROM RibsAdminBundle:Account fu
19
			  JOIN RibsAdminBundle:User u  WITH fu.user = u
20
			  WHERE u.archived = :archived and u != :current_account
21
			")
22
            ->setParameter("archived", $archived)
23
            ->setParameter("current_account", $current_account);
24
25
        return $query->getResult();
26
    }
27
}
28