summaryrefslogtreecommitdiff
path: root/app/php/model/Calendar.php
blob: 9e1afce6cfc8e0da6eb30b4ff9d846410dd7667b (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
<?php

Prado::using('Application.db.ActiveRecord');
Prado::using('Application.model.Entry');
Prado::using('Application.model.Category');

class Calendar extends ActiveRecord {

    const TABLE = 'calendars';

    public $UID;
    public $Url;
    public $Name;
    public $Website;
    public $Visible;
    public $LastUpdated;

    public $CategoryID;

    public static $COLUMN_MAPPING = [
        'uid' => 'UID',
        'url' => 'Url',
        'name' => 'Name',
        'website' => 'Website',
        'visible' => 'Visible',
        'last_updated' => 'LastUpdated',
        '_category' => 'CategoryID'
    ];

    public static $RELATIONS = [
        'Entries' => [self::HAS_MANY, 'Entry', '_calendar'],
        'Category' => [self::BELONGS_TO, 'Category', '_category']
    ];

    public static function finder($className=__CLASS__) {
        return parent::finder($className);
    }

}

?>