Files
quicknotes/db/notemapper.php
Matias De lellis 886605bc01 Initial release
2016-05-20 09:46:46 -03:00

23 lines
565 B
PHP

<?php
namespace OCA\QuickNotes\Db;
use OCP\IDb;
use OCP\AppFramework\Db\Mapper;
class NoteMapper extends Mapper {
public function __construct(IDb $db) {
parent::__construct($db, 'quicknotes_notes', '\OCA\QuickNotes\Db\Note');
}
public function find($id, $userId) {
$sql = 'SELECT * FROM *PREFIX*quicknotes_notes WHERE id = ? AND user_id = ?';
return $this->findEntity($sql, [$id, $userId]);
}
public function findAll($userId) {
$sql = 'SELECT * FROM *PREFIX*quicknotes_notes WHERE user_id = ?';
return $this->findEntities($sql, [$userId]);
}
}