diff options
| author | Syndamia <kamen@syndamia.com> | 2025-01-26 18:52:57 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2025-01-26 22:21:31 +0200 |
| commit | 18677f1e23ac097d859cde1030ce6149585f5574 (patch) | |
| tree | 5f8ada1bdcbd5db1ba47be6f9c9932b33468144f | |
| parent | a2592eca1b76f1cc607e0e449bc635a16f0b007f (diff) | |
| download | nowayforward_human-18677f1e23ac097d859cde1030ce6149585f5574.tar nowayforward_human-18677f1e23ac097d859cde1030ce6149585f5574.tar.gz nowayforward_human-18677f1e23ac097d859cde1030ce6149585f5574.zip | |
feat(models): Implement model for ArchiveList
| -rw-r--r-- | models/archivelist.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/models/archivelist.php b/models/archivelist.php new file mode 100644 index 0000000..3723419 --- /dev/null +++ b/models/archivelist.php @@ -0,0 +1,33 @@ +<?php +namespace Database; +use PDO; + +class ArchiveList extends Table { + public $LID; + public $AuthorUID; + public $Name; + public $Description; + + static function create(int $AuthorUID, string $Name, string $Description) : int { + return Table::_create( + 'ArchiveLists', + '(AuthorUID, Name, Description)', + "(\"$AuthorUID\", \"$Name\", \"$Description\")" + ); + } + + static function fromDB(int $LID) : ArchiveList { + return Table::_fromDB( + "SELECT * FROM ArchiveLists WHERE LID = \"$LID\"", + 'Database\ArchiveLists' + ); + } + + static function allListsByUser(int $UID) : array { + return Table::_get_all( + 'ArchiveLists', + 'Database\ArchiveLists', + "WHERE AuthorUID = \"$UID\"" + ); + } +} |
