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

Method getReportByToken

lib/Db/ShareMapper.php:46–62  ·  view source on GitHub ↗

* get all shared reports by token * uses for public pages * @param $token * @return array * @throws Exception */

($token)

Source from the content-addressed store, hash-verified

44 * @throws Exception
45 */
46 public function getReportByToken($token)
47 {
48 $sql = $this->db->getQueryBuilder();
49 $sql->from(self::TABLE_NAME_REPORT, 'DS')
50 ->leftJoin('DS', self::TABLE_NAME, 'SHARE', $sql->expr()->eq('DS.id', 'SHARE.item_source'))
51 ->select('DS.*')
52 ->addSelect('SHARE.permissions')
53 ->selectAlias('SHARE.domain', 'domain')
54 ->selectAlias('SHARE.password', 'password')
55 ->where($sql->expr()->eq('SHARE.token', $sql->createNamedParameter($token)))
56 ->andWhere($sql->expr()->eq('SHARE.item_type', $sql->createNamedParameter('report')))
57 ->andWhere($sql->expr()->eq('SHARE.uid_initiator', 'DS.user_id'));
58 $statement = $sql->executeQuery();
59 $result = $statement->fetch();
60 $statement->closeCursor();
61 return $result;
62 }
63
64 /**
65 * get all shared reports

Callers 4

authenticatePasswordMethod · 0.45
indexPublicMethod · 0.45
indexPublicMinMethod · 0.45
readPublicMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected