mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 15:47:17 +01:00
Add return types to ColorMapper
This commit is contained in:
@@ -5,28 +5,30 @@ use OCP\IDBConnection;
|
||||
use OCP\AppFramework\Db\Mapper;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
|
||||
use OCA\QuickNotes\Db\Color;
|
||||
|
||||
class ColorMapper extends Mapper {
|
||||
|
||||
public function __construct(IDBConnection $db) {
|
||||
parent::__construct($db, 'quicknotes_colors', '\OCA\QuickNotes\Db\Color');
|
||||
}
|
||||
|
||||
public function find($id) {
|
||||
public function find($id): Color {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_colors WHERE id = ?';
|
||||
return $this->findEntity($sql, [$id]);
|
||||
}
|
||||
|
||||
public function findAll() {
|
||||
public function findAll(): array {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_colors';
|
||||
return $this->findEntities($sql, []);
|
||||
}
|
||||
|
||||
public function findByColor($color) {
|
||||
public function findByColor(string $color): Color {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_colors WHERE color = ?';
|
||||
return $this->findEntity($sql, [$color]);
|
||||
}
|
||||
|
||||
public function colorExists($color) {
|
||||
public function colorExists(string $color): bool {
|
||||
$sql = 'SELECT * FROM *PREFIX*quicknotes_colors WHERE color = ?';
|
||||
try {
|
||||
$this->findEntity($sql, [$color]);
|
||||
|
||||
Reference in New Issue
Block a user