/** * {@inheritdoc} */ public function getTag($tagName, $userVisible, $userAssignable) { $userVisible = (int) $userVisible; $userAssignable = (int) $userAssignable; $result = $this->selectTagQuery->setParameter('name', $tagName)->setParameter('visibility', $userVisible)->setParameter('editable', $userAssignable)->execute(); $row = $result->fetch(); $result->closeCursor(); if (!$row) { throw new TagNotFoundException('Tag ("' . $tagName . '", ' . $userVisible . ', ' . $userAssignable . ') does not exist'); } return $this->createSystemTagFromRow($row); }
/** * Add where statements to a query builder matching the given notification * * @param IQueryBuilder $sql * @param INotification $notification */ protected function sqlWhere(IQueryBuilder $sql, INotification $notification) { if ($notification->getApp() !== '') { $sql->andWhere($sql->expr()->eq('app', $sql->createParameter('app'))); $sql->setParameter('app', $notification->getApp()); } if ($notification->getUser() !== '') { $sql->andWhere($sql->expr()->eq('user', $sql->createParameter('user')))->setParameter('user', $notification->getUser()); } if ($notification->getDateTime()->getTimestamp() !== 0) { $sql->andWhere($sql->expr()->eq('timestamp', $sql->createParameter('timestamp')))->setParameter('timestamp', $notification->getDateTime()->getTimestamp()); } if ($notification->getObjectType() !== '') { $sql->andWhere($sql->expr()->eq('object_type', $sql->createParameter('objectType')))->setParameter('objectType', $notification->getObjectType()); } if ($notification->getObjectId() !== '') { $sql->andWhere($sql->expr()->eq('object_id', $sql->createParameter('objectId')))->setParameter('objectId', $notification->getObjectId()); } if ($notification->getSubject() !== '') { $sql->andWhere($sql->expr()->eq('subject', $sql->createParameter('subject')))->setParameter('subject', $notification->getSubject()); } if ($notification->getMessage() !== '') { $sql->andWhere($sql->expr()->eq('message', $sql->createParameter('message')))->setParameter('message', $notification->getMessage()); } if ($notification->getLink() !== '') { $sql->andWhere($sql->expr()->eq('link', $sql->createParameter('link')))->setParameter('link', $notification->getLink()); } }