db->getQueryBuilder(); $qb->select('*') ->from('upschooling_chats') ->where($qb->expr()->eq('ticket_id', $qb->createNamedParameter($ticketId, IQueryBuilder::PARAM_INT))); return $this->findEntities($qb); } /** * @param int $ticketId * @return Entity|MatrixChat * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws DoesNotExistException */ public function findCurrent(int $ticketId): MatrixChat { /* @var $qb IQueryBuilder */ $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from('upschooling_chats') ->where( $qb->expr()->eq('ticket_id', $qb->createNamedParameter($ticketId, IQueryBuilder::PARAM_INT)), $qb->expr()->isNull('date_end') ); return $this->findEntity($qb); } /** * @param \DateTime $dateTime * @return mixed The database representation of the datetime with timezone. * @throws \Doctrine\DBAL\Exception * @throws \Doctrine\DBAL\Types\ConversionException */ public function convertDateTimeTz(\DateTime $dateTime) { $dateTimeTzType = Type::getType("datetimetz"); return $dateTimeTzType->convertToDatabaseValue($dateTime, $this->db->getDatabasePlatform()); } }