Passed
Push — master ( d93244...31d6f2 )
by Pauli
03:37
created

PlaylistMapper::findUniqueEntity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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 Morris Jobke <[email protected]>
10
 * @author Volkan Gezer <[email protected]>
11
 * @author Pauli Järvinen <[email protected]>
12
 * @copyright Morris Jobke 2014
13
 * @copyright Volkan Gezer 2014
14
 * @copyright Pauli Järvinen 2016 - 2025
15
 */
16
17
namespace OCA\Music\Db;
18
19
use OCP\IConfig;
20
use OCP\IDBConnection;
21
22
/**
23
 * @phpstan-extends BaseMapper<Playlist>
24
 */
25
class PlaylistMapper extends BaseMapper {
26
	public function __construct(IDBConnection $db, IConfig $config) {
27
		parent::__construct($db, $config, 'music_playlists', Playlist::class, 'name');
28
	}
29
30
	/**
31
	 * @param int $trackId
32
	 * @return Playlist[]
33
	 */
34
	public function findListsContainingTrack($trackId) {
35
		$sql = $this->selectEntities('`track_ids` LIKE ?');
36
		$params = ['%|' . $trackId . '|%'];
37
		return $this->findEntities($sql, $params);
38
	}
39
}
40