1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace JhUser\Repository; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Persistence\ObjectRepository; |
6
|
|
|
use JhUser\Entity\Permission; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Class PermissionRepository |
10
|
|
|
* @package JhUser\Repository |
11
|
|
|
* @author Aydin Hassan <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
class PermissionRepository implements PermissionRepositoryInterface, ObjectRepository |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var \Doctrine\Common\Persistence\ObjectRepository |
18
|
|
|
*/ |
19
|
|
|
protected $permissionRepository; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @param ObjectRepository $permissionRepository |
23
|
|
|
*/ |
24
|
|
|
public function __construct(ObjectRepository $permissionRepository) |
25
|
|
|
{ |
26
|
|
|
$this->permissionRepository = $permissionRepository; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param string $name |
31
|
|
|
* @return Permission|null |
32
|
|
|
*/ |
33
|
|
|
public function findByName($name) |
34
|
|
|
{ |
35
|
|
|
return $this->permissionRepository->findOneBy(['name' => $name]); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* findAll(): defined by ObjectRepository. |
40
|
|
|
* |
41
|
|
|
* @see ObjectRepository::findAll() |
42
|
|
|
* @return Permission[] |
43
|
|
|
*/ |
44
|
|
|
public function findAll() |
45
|
|
|
{ |
46
|
|
|
return $this->permissionRepository->findAll(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* find(): defined by ObjectRepository. |
51
|
|
|
* |
52
|
|
|
* @see ObjectRepository::find() |
53
|
|
|
* @param int $id |
54
|
|
|
* @return Permission|null |
55
|
|
|
*/ |
56
|
|
|
public function find($id) |
57
|
|
|
{ |
58
|
|
|
return $this->permissionRepository->find($id); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* findBy(): defined by ObjectRepository. |
63
|
|
|
* |
64
|
|
|
* @see ObjectRepository::findBy() |
65
|
|
|
* @param array $criteria |
66
|
|
|
* @param array|null $orderBy |
67
|
|
|
* @param int|null $limit |
68
|
|
|
* @param int|null $offset |
69
|
|
|
* @return Permission[] |
70
|
|
|
*/ |
71
|
|
|
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
72
|
|
|
{ |
73
|
|
|
return $this->permissionRepository->findBy($criteria, $orderBy, $limit, $offset); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* findOneBy(): defined by ObjectRepository. |
78
|
|
|
* |
79
|
|
|
* @see ObjectRepository::findOneBy() |
80
|
|
|
* @param array $criteria |
81
|
|
|
* @return Permission|null |
82
|
|
|
*/ |
83
|
|
|
public function findOneBy(array $criteria) |
84
|
|
|
{ |
85
|
|
|
return $this->permissionRepository->findOneBy($criteria); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* getClassName(): defined by ObjectRepository. |
90
|
|
|
* |
91
|
|
|
* @see ObjectRepository::getClassName() |
92
|
|
|
* @return string |
93
|
|
|
*/ |
94
|
|
|
public function getClassName() |
95
|
|
|
{ |
96
|
|
|
return $this->permissionRepository->getClassName(); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|