Passed
Push — master ( 582587...3b42e9 )
by Anthony
04:10 queued 11s
created

AccountRepository::findAllUserArchived()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace Ribs\RibsAdminBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use Ribs\RibsAdminBundle\Entity\User;
7
8
class AccountRepository extends EntityRepository
9
{
10
	/**
11
	 * @param User $current_account
12
	 * @param bool $archived
13
	 * @return array function that return a list of all users that are not archived and different of current accout
14
	 */
15
	public function findAllUserArchived(User $current_account, bool $archived = false): array
16
	{
17
		$query = $this->getEntityManager()->createQuery("SELECT fu FROM RibsAdminBundle:Account fu
18
			  JOIN RibsAdminBundle:User u  WITH fu.user = u
19
			  WHERE u.archived = :archived and u != :current_account
20
			")
21
			->setParameter("archived", $archived)
22
			->setParameter("current_account", $current_account);
23
		
24
		return $query->getResult();
25
	}
26
}