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

AccessRightRepository::deleteAllUsersList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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
}