Passed
Push — 4-cactus ( 0f2d11...5c827b )
by Stefano
03:41
created

setRelationshipsAllowedMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * BEdita, API-first content management framework
4
 * Copyright 2019 ChannelWeb Srl, Chialab Srl
5
 *
6
 * This file is part of BEdita: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as published
8
 * by the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * See LICENSE.LGPL or <http://gnu.org/licenses/lgpl-3.0.html> for more details.
12
 */
13
namespace BEdita\API\Controller;
14
15
use Cake\Core\Configure;
16
use Cake\ORM\Association;
17
18
/**
19
 * Controller for `/history` endpoint.
20
 *
21
 * @since 4.1.0
22
 * @property \BEdita\Core\Model\Table\HistoryTable $Table
23
 */
24
class HistoryController extends ResourcesController
25
{
26
    /**
27
     * @inheritDoc
28
     */
29
    protected $_defaultConfig = [
30
        'allowedAssociations' => [
31
            'user' => ['users'],
32
        ],
33
    ];
34
35
    /**
36
     * @inheritDoc
37
     */
38
    public function initialize(): void
39
    {
40
        $this->modelClass = (string)Configure::read('History.table', 'History');
41
42
        parent::initialize();
43
    }
44
45
    /**
46
     * @inheritDoc
47
     */
48
    protected function setRelationshipsAllowedMethods(Association $association)
49
    {
50
        $this->request->allowMethod(['get']);
51
    }
52
}
53