aboutsummaryrefslogtreecommitdiff
path: root/lib/models/ConsultationEvent.php
blob: afc69805ffd52bb1f72d202dfb652a567f24591b (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
<?php
/**
 * @author  Jan-Hendrik Willms <tleilax+studip@gmail.com>
 * @license GPL2 or any later version
 * @since   Stud.IP 5.1
 *
 * @property int slot_id database column
 * @property int id alias column for slot_id
 * @property string user_id database column
 * @property string event_id database column
 * @property int mkdate database column
 * @property ConsultationSlot slot belongs_to ConsultationSlot
 * @property EventData event belongs_to Event
 */
class ConsultationEvent extends SimpleORMap
{
    protected static function configure($config = [])
    {
        $config['db_table'] = 'consultation_events';

        $config['belongs_to']['slot'] = [
            'class_name'  => ConsultationSlot::class,
            'foreign_key' => 'slot_id',
        ];
        $config['has_one']['event'] = [
            'class_name'        => EventData::class,
            'foreign_key'       => 'event_id',
            'assoc_foreign_key' => 'event_id',
            'on_delete'         => 'delete',
        ];

        parent::configure($config);
    }
}