aboutsummaryrefslogtreecommitdiff
path: root/lib/models/vips/VipsGroupMember.php
blob: c6be629f0a5a2fcc97ca6aa95472a734304d5839 (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
42
43
44
45
46
47
48
49
50
<?php
/*
 * VipsGroupMember.php - Vips group member class for Stud.IP
 * Copyright (c) 2016  Elmar Ludwig
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */

/**
 * @license GPL2 or any later version
 *
 * @property array $id alias for pk
 * @property string $group_id database column
 * @property string $user_id database column
 * @property int $start database column
 * @property int|null $end database column
 * @property VipsGroup $group belongs_to VipsGroup
 * @property User $user belongs_to User
 * @property mixed $vorname additional field
 * @property mixed $nachname additional field
 * @property mixed $username additional field
 */
class VipsGroupMember extends SimpleORMap
{
    /**
     * Configure the database mapping.
     */
    protected static function configure($config = [])
    {
        $config['db_table'] = 'etask_group_members';

        $config['additional_fields']['vorname'] = ['user', 'vorname'];
        $config['additional_fields']['nachname'] = ['user', 'nachname'];
        $config['additional_fields']['username'] = ['user', 'username'];

        $config['belongs_to']['group'] = [
            'class_name'  => VipsGroup::class,
            'foreign_key' => 'group_id'
        ];
        $config['belongs_to']['user'] = [
            'class_name'  => User::class,
            'foreign_key' => 'user_id'
        ];

        parent::configure($config);
    }
}