* * @author 2023 Christoph Wurst * * @license GNU AGPL version 3 or any later version * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ namespace OCA\DAV\Db; use OCP\AppFramework\Db\QBMapper; use OCP\IDBConnection; /** * @template-extends QBMapper */ class PropertyMapper extends QBMapper { private const TABLE_NAME = 'properties'; public function __construct(IDBConnection $db) { parent::__construct($db, self::TABLE_NAME, Property::class); } /** * @return Property[] */ public function findPropertyByPathAndName(string $userId, string $path, string $name): array { $selectQb = $this->db->getQueryBuilder(); $selectQb->select('*') ->from(self::TABLE_NAME) ->where( $selectQb->expr()->eq('userid', $selectQb->createNamedParameter($userId)), $selectQb->expr()->eq('propertypath', $selectQb->createNamedParameter($path)), $selectQb->expr()->eq('propertyname', $selectQb->createNamedParameter($name)), ); return $this->findEntities($selectQb); } }