Lines
100.00%
12 / 12
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getBreadcrumbs | 100.00% | 11 / 11 | 100.00% | 1 / 1 | 2 | ||
| 30 | class AttachmentCollection | |
| 31 | { | |
| 32 | /** | |
| 33 | * Constructor. | |
| 34 | */ | |
| 35 | public function __construct( | |
| 36 | protected Configuration $configuration, | |
| 37 | ) { | |
| 38 | } | |
| 39 | ||
| 40 | /** | |
| 41 | * Get an array with minimalistic attachment metadata. | |
| 42 | */ | |
| 43 | public function getBreadcrumbs(): array | |
| 44 | { | |
| 45 | $breadCrumbs = []; | |
| 46 | ||
| 47 | $query = sprintf( | |
| 48 | ' | |
| 49 | SELECT | |
| 50 | fa.id AS id, | |
| 51 | fa.record_id AS record_id, | |
| 52 | fa.record_lang AS record_lang, | |
| 53 | fa.filename AS filename, | |
| 54 | fa.filesize AS filesize, | |
| 55 | fa.mime_type AS mime_type, | |
| 56 | fd.thema AS thema | |
| 57 | FROM | |
| 58 | %s fa | |
| 59 | JOIN | |
| 60 | %s fd | |
| 61 | ON | |
| 62 | fa.record_id = fd.id | |
| 63 | GROUP BY | |
| 64 | fa.id,fa.record_id,fa.record_lang,fa.filename,fa.filesize,fa.mime_type,fd.thema', | |
| 65 | Database::getTablePrefix() . 'faqattachment', | |
| 66 | Database::getTablePrefix() . 'faqdata', | |
| 67 | ); | |
| 68 | ||
| 69 | $result = $this->configuration->getDb()->query($query); | |
| 70 | ||
| 71 | if ($result) { | |
| 72 | return $this->configuration->getDb()->fetchAll($result) ?? []; | |
| 73 | } | |
| 74 | ||
| 75 | return $breadCrumbs; | |
| 76 | } | |
| 77 | } |