Completed
Push — master ( a65844...019578 )
by Alberto
15s queued 13s
created

RolesController::save()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
/**
3
 * BEdita, API-first content management framework
4
 * Copyright 2022 Atlas 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 App\Controller\Admin;
14
15
use Cake\Cache\Cache;
16
use Cake\Http\Response;
17
18
/**
19
 * Roles Controller
20
 *
21
 * @property \App\Controller\Component\PropertiesComponent $Properties
22
 */
23
class RolesController extends AdministrationBaseController
24
{
25
    public const CACHE_KEY_ROLES = 'roles';
26
27
    /**
28
     * @inheritDoc
29
     */
30
    protected $endpoint = '/roles';
31
32
    /**
33
     * @inheritDoc
34
     */
35
    protected $resourceType = 'roles';
36
37
    /**
38
     * @inheritDoc
39
     */
40
    protected $readonly = false;
41
42
    /**
43
     * @inheritDoc
44
     */
45
    protected $properties = [
46
        'name' => 'string',
47
        'description' => 'text',
48
    ];
49
50
    /**
51
     * @inheritDoc
52
     */
53
    public function save(): ?Response
54
    {
55
        Cache::delete(self::CACHE_KEY_ROLES);
56
57
        return parent::save();
58
    }
59
60
    /**
61
     * @inheritDoc
62
     */
63
    public function remove(string $id): ?Response
64
    {
65
        Cache::delete(self::CACHE_KEY_ROLES);
66
67
        return parent::remove($id);
68
    }
69
}
70