Total Complexity | 3 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | trait Repository |
||
16 | { |
||
17 | /** |
||
18 | * @return EntityManager |
||
19 | */ |
||
20 | abstract protected function getEntityManager(); |
||
21 | |||
22 | /** |
||
23 | * @return ClassMetadata |
||
24 | */ |
||
25 | abstract protected function getClassMetadata(); |
||
26 | |||
27 | /** |
||
28 | * Returns the AclFilter to fetch ACL filtering SQL. |
||
29 | */ |
||
30 | public function getAclFilter(): AclFilter |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Return native SQL query to get all ID. |
||
40 | */ |
||
41 | public function getAllIdsQuery(): string |
||
42 | { |
||
43 | $connection = $this->getEntityManager()->getConnection(); |
||
44 | $qb = $connection->createQueryBuilder() |
||
45 | ->select('id') |
||
46 | ->from($connection->quoteIdentifier($this->getClassMetadata()->getTableName())); |
||
47 | |||
48 | return $qb->getSQL(); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Return native SQL query to get all ID of object owned by given user. |
||
53 | */ |
||
54 | protected function getAllIdsForOwnerQuery(User $user): string |
||
63 | } |
||
64 | } |
||
65 |