aboutsummaryrefslogtreecommitdiff
path: root/lib/models/LtiTool.php
blob: 41b6f32199ad023e4bfe5d7131af2a45a0425f57 (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
<?php
/**
 * LtiTool.php - LTI consumer API for Stud.IP
 *
 * 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.
 *
 * @author      Elmar Ludwig
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
 */

class LtiTool extends SimpleORMap
{
    /**
     * Configure the database mapping.
     */
    protected static function configure($config = [])
    {
        $config['db_table'] = 'lti_tool';

        $config['has_many']['links'] = [
            'class_name'        => LtiData::class,
            'assoc_foreign_key' => 'tool_id',
            'on_delete'         => 'delete'
        ];

        parent::configure($config);
    }

    /**
     * Find all entries.
     */
    public static function findAll()
    {
        return self::findBySQL('1 ORDER BY name');
    }
}