Passed
Pull Request — master (#875)
by Pauli
04:32 queued 02:24
created

PodcastChannelMapper::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php declare(strict_types=1);
2
3
/**
4
 * ownCloud - Music app
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Pauli Järvinen <[email protected]>
10
 * @copyright Pauli Järvinen 2021
11
 */
12
13
namespace OCA\Music\Db;
14
15
use \OCP\AppFramework\Db\Entity;
16
use \OCP\IDBConnection;
17
18
class PodcastChannelMapper extends BaseMapper {
19
	public function __construct(IDBConnection $db) {
20
		parent::__construct($db, 'music_podcast_channels', '\OCA\Music\Db\PodcastChannel', 'title');
21
	}
22
23
	/**
24
	 * @see \OCA\Music\Db\BaseMapper::findUniqueEntity()
25
	 * @param PodcastChannel $channel
26
	 * @return PodcastChannel
27
	 */
28
	protected function findUniqueEntity(Entity $channel) : Entity {
29
		$sql = $this->selectUserEntities("`rss_hash` = ?");
30
		return $this->findEntity($sql, [$channel->getUserId(), $channel->getRssHash()]);
31
	}
32
}
33