Issues (35)

src/Model/Testimonial.php (11 issues)

1
<?php
2
3
namespace Dynamic\Elements\Model;
4
5
use SilverStripe\ORM\DataObject;
6
use SilverStripe\Security\Permission;
7
use SilverStripe\Security\PermissionProvider;
8
9
/**
10
 * Class Testimonial
11
 * @package Dynamic\Elements\Model
12
 *
13
 * @property string $Title
14
 * @property string $Content
15
 * @property string $Name
16
 * @property string $Position
17
 * @property string $Affiliation
18
 */
19
class Testimonial extends DataObject implements PermissionProvider
20
{
21
    /**
22
     * @var string
23
     */
24
    private static $singular_name = 'Testimonial';
0 ignored issues
show
The private property $singular_name is not used, and could be removed.
Loading history...
25
26
    /**
27
     * @var string
28
     */
29
    private static $plural_name = 'Testimonials';
0 ignored issues
show
The private property $plural_name is not used, and could be removed.
Loading history...
30
31
    /**
32
     * @var string
33
     */
34
    private static $table_name = 'Testimonial';
0 ignored issues
show
The private property $table_name is not used, and could be removed.
Loading history...
35
36
    /**
37
     * @var array
38
     */
39
    private static $db = [
0 ignored issues
show
The private property $db is not used, and could be removed.
Loading history...
40
        'Title' => 'Varchar(255)',
41
        'Content' => 'Text',
42
        'Name' => 'Varchar(255)',
43
        'Position' => 'Varchar(255)',
44
        'Affiliation' => 'Varchar(255)',
45
    ];
46
47
    /**
48
     * @var array
49
     */
50
    private static $many_many = [
0 ignored issues
show
The private property $many_many is not used, and could be removed.
Loading history...
51
        'TestimonialCategories' => TestimonialCategory::class,
52
    ];
53
54
    /**
55
     * @var array
56
     */
57
    private static $field_labels = [
0 ignored issues
show
The private property $field_labels is not used, and could be removed.
Loading history...
58
        'Title' => 'Title',
59
        'Content.Summary' => 'Testimonial',
60
        'Name' => 'Name',
61
    ];
62
63
    /**
64
     *
65
     * @var array
66
     */
67
    private static $summary_fields = [
0 ignored issues
show
The private property $summary_fields is not used, and could be removed.
Loading history...
68
        'Title',
69
        'Content.Summary',
70
        'Name',
71
    ];
72
73
    /**
74
     * @return array
75
     */
76 1
    public function providePermissions()
77
    {
78 1
        return ['Testimonial_MANAGE' => 'Manage Testimonials'];
79
    }
80
81
    /**
82
     * @param null $member
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
83
     * @param array $context
84
     * @return bool|int
85
     */
86 2
    public function canCreate($member = null, $context = [])
87
    {
88 2
        return Permission::check('Testimonial_MANAGE', 'any', $member);
89
    }
90
91
    /**
92
     * @param null $member
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
93
     * @return bool|int
94
     */
95 2
    public function canEdit($member = null)
96
    {
97 2
        return Permission::check('Testimonial_MANAGE', 'any', $member);
98
    }
99
100
    /**
101
     * @param null $member
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
102
     * @return bool|int
103
     */
104 2
    public function canDelete($member = null)
105
    {
106 2
        return Permission::check('Testimonial_MANAGE', 'any', $member);
107
    }
108
109
    /**
110
     * @param null $member
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $member is correct as it would always require null to be passed?
Loading history...
111
     * @return bool
112
     */
113 4
    public function canView($member = null)
114
    {
115 4
        return true;
116
    }
117
}
118