1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* Copyright (C) 2020 Jan Böhmer |
4
|
|
|
* |
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU Affero General Public License as published |
7
|
|
|
* by the Free Software Foundation, either version 3 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* |
10
|
|
|
* This program is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
* GNU Affero General Public License for more details. |
14
|
|
|
* |
15
|
|
|
* You should have received a copy of the GNU Affero General Public License |
16
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace App\Repository; |
20
|
|
|
|
21
|
|
|
use App\Entity\Department; |
22
|
|
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; |
23
|
|
|
use Doctrine\Persistence\ManagerRegistry; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @method Department|null find($id, $lockMode = null, $lockVersion = null) |
27
|
|
|
* @method Department|null findOneBy(array $criteria, array $orderBy = null) |
28
|
|
|
* @method Department[] findAll() |
29
|
|
|
* @method Department[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) |
30
|
|
|
*/ |
31
|
|
|
class DepartmentRepository extends ServiceEntityRepository |
32
|
|
|
{ |
33
|
|
|
public function __construct(ManagerRegistry $registry) |
34
|
|
|
{ |
35
|
|
|
parent::__construct($registry, Department::class); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/* |
39
|
|
|
public function findByExampleField($value) |
40
|
|
|
{ |
41
|
|
|
return $this->createQueryBuilder('d') |
42
|
|
|
->andWhere('d.exampleField = :val') |
43
|
|
|
->setParameter('val', $value) |
44
|
|
|
->orderBy('d.id', 'ASC') |
45
|
|
|
->setMaxResults(10) |
46
|
|
|
->getQuery() |
47
|
|
|
->getResult() |
48
|
|
|
; |
49
|
|
|
} |
50
|
|
|
*/ |
51
|
|
|
|
52
|
|
|
/* |
53
|
|
|
public function findOneBySomeField($value): ?Department |
54
|
|
|
{ |
55
|
|
|
return $this->createQueryBuilder('d') |
56
|
|
|
->andWhere('d.exampleField = :val') |
57
|
|
|
->setParameter('val', $value) |
58
|
|
|
->getQuery() |
59
|
|
|
->getOneOrNullResult() |
60
|
|
|
; |
61
|
|
|
} |
62
|
|
|
*/ |
63
|
|
|
} |
64
|
|
|
|