diff options
Diffstat (limited to 'models')
| -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\"" + ); + } +} |
