Passed
Push — master ( 04e680...003b31 )
by Anthony
01:53
created

FosUserRepository::findAllUserArchived()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace Ribs\RibsAdminBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
1 ignored issue
show
Bug introduced by
The type Doctrine\ORM\EntityRepository was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Ribs\RibsAdminBundle\Entity\User;
7
8
class FosUserRepository 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:FosUser 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
}