blob: baafe214b294b9ea50d3d6bcf4f45a1f15fb9ad0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
namespace Micropoly\TemplateModelWrappers;
use Micropoly\Models\Note;
use SQLite3;
class NoteForTemplate
{
private SQLite3 $db;
private Note $note;
/**
* NoteForModel constructor.
* @param SQLite3 $db
* @param Note $note
*/
public function __construct(SQLite3 $db, Note $note)
{
$this->db = $db;
$this->note = $note;
}
/**
* @param SQLite3 $db
* @param Note[] $notes
* @return self[]
*/
public static function wrapMany(SQLite3 $db, array $notes): array
{
return array_map(static fn(Note $note) => new self($db, $note), $notes);
}
public function getId(): string { return $this->note->getId(); }
public function getContent(): string { return $this->note->getContent(); }
public function getTags(): array { return $this->note->getTags(); }
public function getAttachments(): array
{
return $this->note->getAttachments($this->db);
}
}
|