1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- declare(strict_types=1);
- namespace OC\Updater;
- use OCP\AppFramework\Db\DoesNotExistException;
- use OCP\AppFramework\Db\QBMapper;
- use OCP\DB\QueryBuilder\IQueryBuilder;
- use OCP\IDBConnection;
- class ChangesMapper extends QBMapper {
- public const TABLE_NAME = 'whats_new';
- public function __construct(IDBConnection $db) {
- parent::__construct($db, self::TABLE_NAME);
- }
-
- public function getChanges(string $version): Changes {
-
- $qb = $this->db->getQueryBuilder();
- $result = $qb->select('*')
- ->from(self::TABLE_NAME)
- ->where($qb->expr()->eq('version', $qb->createNamedParameter($version)))
- ->executeQuery();
- $data = $result->fetch();
- $result->closeCursor();
- if ($data === false) {
- throw new DoesNotExistException('Changes info is not present');
- }
- return Changes::fromRow($data);
- }
- }
|