aboutsummaryrefslogtreecommitdiff
path: root/models/archivelist.php
blob: 3723419da13add049a07489ec2b0b67837523ed1 (plain) (blame)
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
<?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\""
        );
    }
}