TransferOwnershipMapper.php 742 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Files\Db;
  8. use OCP\AppFramework\Db\QBMapper;
  9. use OCP\IDBConnection;
  10. /**
  11. * @template-extends QBMapper<TransferOwnership>
  12. */
  13. class TransferOwnershipMapper extends QBMapper {
  14. public function __construct(IDBConnection $db) {
  15. parent::__construct($db, 'user_transfer_owner', TransferOwnership::class);
  16. }
  17. public function getById(int $id): TransferOwnership {
  18. $qb = $this->db->getQueryBuilder();
  19. $qb->select('*')
  20. ->from($this->getTableName())
  21. ->where(
  22. $qb->expr()->eq('id', $qb->createNamedParameter($id))
  23. );
  24. return $this->findEntity($qb);
  25. }
  26. }