MCPcopy Create free account
hub / github.com/Rello/analytics / search

Method search

lib/Db/ReportMapper.php:355–378  ·  view source on GitHub ↗

* search reports by search string * @param $searchString * @return array * @throws Exception */

($searchString)

Source from the content-addressed store, hash-verified

353 * @throws Exception
354 */
355 public function search($searchString)
356 {
357 $sql = $this->db->getQueryBuilder();
358 $sql->from(self::TABLE_NAME)
359 ->select('id')
360 ->addSelect('name')
361 ->addSelect('type')
362 ->addSelect('visualization')
363 ->where($sql->expr()->eq('user_id', $sql->createNamedParameter($this->userId)))
364 ->andWhere($sql->expr()->iLike('name', $sql->createNamedParameter('%' . $this->db->escapeLikeParameter($searchString) . '%')))
365 ->orderBy('name', 'ASC');
366 $statement = $sql->executeQuery();
367 $result = $statement->fetchAll();
368 $statement->closeCursor();
369
370 if ($result !== false && is_array($result)) {
371 foreach ($result as &$row) {
372 $row['type'] = (int) $row['type'];
373 }
374 unset($row); // Unset reference
375 }
376
377 return $result;
378 }
379
380 /**
381 * get the report owner

Callers

nothing calls this directly

Calls 1

eqMethod · 0.80

Tested by

no test coverage detected