nextcloud-app-radio/db/stationmapper.php

24 lines
624 B
PHP
Raw Permalink Normal View History

2017-02-16 12:00:43 +00:00
<?php
namespace OCA\Radio\Db;
2017-08-05 11:21:11 +00:00
use OCP\IDBConnection;
2017-02-16 12:00:43 +00:00
use OCP\AppFramework\Db\Mapper;
class StationMapper extends Mapper {
2017-08-05 11:21:11 +00:00
public function __construct(IDBConnection $db) {
2017-02-16 12:00:43 +00:00
parent::__construct($db, 'radio_stations', '\OCA\Radio\Db\Station');
}
public function find($id, $userId) {
2017-02-21 16:57:30 +00:00
$sql = 'SELECT * FROM *PREFIX*radio_stations WHERE id = ? AND user_id = ?';
2017-02-16 12:00:43 +00:00
return $this->findEntity($sql, [$id, $userId]);
}
public function findAll($userId) {
2017-02-21 16:57:30 +00:00
$sql = 'SELECT * FROM *PREFIX*radio_stations WHERE user_id = ?';
2017-02-16 12:00:43 +00:00
return $this->findEntities($sql, [$userId]);
}
}