Passed
Push — master ( 5ebfb5...3fb9e3 )
by Anthony
07:07
created

AccessRightRepository   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A deleteAllUsersList() 0 7 1
1
<?php
2
3
namespace Ribs\RibsAdminBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use Ribs\RibsAdminBundle\Entity\AccessRight;
7
use Ribs\RibsAdminBundle\Entity\User;
8
9
class AccessRightRepository extends EntityRepository
10
{
11
	/**
12
	 * @param AccessRight $access_right
13
	 * function that delete all user which are in a list of rights
14
	 */
15
	public function deleteAllUsersList(AccessRight $access_right)
16
	{
17
		$query = $this->getEntityManager()->getConnection()->prepare("UPDATE user SET id_access_right = NULL WHERE
18
 			id_access_right = :id_access_right
19
 		");
20
		$query->bindValue("id_access_right", $access_right->getId());
21
		$query->execute();
22
	}
23
}