connection->getQueryBuilder(); $query->select('m.fileid', ...TimelineQuery::TIMELINE_SELECT) ->from('memories', 'm') ->where($query->expr()->eq('m.fileid', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))) ; // JOIN filecache for etag $query->innerJoin('m', 'filecache', 'f', $query->expr()->eq('f.fileid', 'm.fileid')); // JOIN with mimetypes to get the mimetype $query->join('f', 'mimetypes', 'mimetypes', $query->expr()->eq('f.mimetype', 'mimetypes.id')); return $query->executeQuery()->fetch(); } }