Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function loadDomainsForUser(User $user): array |
||
27 | { |
||
28 | $database = $user->getDatabase(); |
||
29 | |||
30 | $statement = $database->prepare(<<<'SQL' |
||
31 | SELECT d.* |
||
32 | FROM domain d |
||
33 | INNER JOIN userdomain ud on d.id = ud.domain |
||
34 | WHERE ud.user = :user |
||
35 | AND d.enabled = 1 |
||
36 | SQL |
||
37 | ); |
||
38 | $statement->execute([ |
||
39 | ':user' => $user->getId() |
||
40 | ]); |
||
41 | |||
42 | $resultObjects = $statement->fetchAll(PDO::FETCH_CLASS, Domain::class); |
||
43 | |||
44 | /** @var Domain $t */ |
||
45 | foreach ($resultObjects as $t) { |
||
46 | $t->setDatabase($database); |
||
47 | } |
||
48 | |||
49 | return $resultObjects; |
||
50 | } |
||
51 | } |