Lines
0.00%
0 / 14
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Link | 0.00% | 0 / 14 | 0.00% | 0 / 1 | 6 | 0.00% | 0 / 1 | |||
| readSearchResultList | 0.00% | 0 / 14 | 0.00% | 0 / 1 | 6 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * @package ClientDldb | |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 6 | **/ | |
| 7 | ||
| 8 | namespace BO\Zmsdldb\MySQL; | |
| 9 | ||
| 10 | use BO\Zmsdldb\MySQL\Collection\Links as Collection; | |
| 11 | use BO\Zmsdldb\Elastic\Link as Base; | |
| 12 | ||
| 13 | /** @psalm-api */ | |
| 14 | class Link extends Base | |
| 15 | { | |
| 16 | #[\Override] | |
| 17 | public function readSearchResultList(mixed $query): Collection | |
| 18 | { | |
| 19 | try { | |
| 20 | #$query = '+' . implode(' +', explode(' ', $query)); | |
| 21 | $sqlArgs = [$this->locale, $query]; | |
| 22 | $sql = "SELECT tl.data_json | |
| 23 | FROM topic_links AS tl | |
| 24 | WHERE | |
| 25 | tl.locale = ? AND MATCH (tl.search) AGAINST (? IN BOOLEAN MODE) | |
| 26 | "; | |
| 27 | ||
| 28 | $linklist = new Collection(); | |
| 29 | ||
| 30 | $stm = $this->access()->prepare($sql); | |
| 31 | $stm->execute($sqlArgs); | |
| 32 | $stm->fetchAll(\PDO::FETCH_FUNC, function (?string $data_json) use ($linklist): void { | |
| 33 | $link = new \BO\Zmsdldb\MySQL\Entity\Link(); | |
| 34 | $link->offsetSet('data_json', $data_json); | |
| 35 | $linklist[$link['link']] = $link; | |
| 36 | }); | |
| 37 | ||
| 38 | return $linklist; | |
| 39 | } catch (\Exception $e) { | |
| 40 | throw $e; | |
| 41 | } | |
| 42 | } | |
| 43 | } |