Completed
Branch dev (420f4e)
by
unknown
35:10 queued 25:32
created

EEM_Question_Option   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 11

Importance

Changes 0
Metric Value
dl 0
loc 79
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 11

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 71 1
1
<?php
2
3
/**
4
 * Question Group Model
5
 *
6
 * @package     Event Espresso
7
 * @subpackage  includes/models/
8
 * @author      Michael Nelson
9
 */
10
class EEM_Question_Option extends EEM_Soft_Delete_Base
11
{
12
13
    // private instance of the Attendee object
14
    protected static $_instance = null;
15
16
17
    protected function __construct($timezone = null)
18
    {
19
        $this->singular_item = esc_html__('Question Option', 'event_espresso');
20
        $this->plural_item   = esc_html__('Question Options', 'event_espresso');
21
22
        $this->_tables          = [
23
            'Question_Option' => new EE_Primary_Table('esp_question_option', 'QSO_ID'),
24
        ];
25
        $this->_fields          = [
26
            'Question_Option' => [
27
                'QSO_ID'      => new EE_Primary_Key_Int_Field(
28
                    'QSO_ID', esc_html__('Question Option ID', 'event_espresso')
29
                ),
30
                'QST_ID'      => new EE_Foreign_Key_Int_Field(
31
                    'QST_ID',
32
                    esc_html__('Question ID', 'event_espresso'),
33
                    false,
34
                    0,
35
                    'Question'
36
                ),
37
                'QSO_value'   => new EE_Plain_Text_Field(
38
                    'QSO_value',
39
                    esc_html__("Question Option Value", "event_espresso"),
40
                    false,
41
                    ''
42
                ),
43
                'QSO_desc'    => new EE_Post_Content_Field(
44
                    'QSO_desc',
45
                    esc_html__('Question Option Description', 'event_espresso'),
46
                    false,
47
                    ''
48
                ),
49
                'QSO_order'   => new EE_Integer_Field(
50
                    'QSO_order',
51
                    esc_html__('Question Option Order', 'event_espresso'),
52
                    false,
53
                    0
54
                ),
55
                'QSO_system'  => new EE_Plain_Text_Field(
56
                    'QSO_system',
57
                    esc_html__('Internal string ID for question option', 'event_espresso'),
58
                    true,
59
                    null
60
                ),
61
                'QSO_deleted' => new EE_Trashed_Flag_Field(
62
                    'QSO_deleted',
63
                    esc_html__('Flag indicating Option was trashed', 'event_espresso'),
64
                    false,
65
                    false
66
                ),
67
            ],
68
        ];
69
        $this->_model_relations = [
70
            'Question' => new EE_Belongs_To_Relation(),
71
        ];
72
73
        $this->_caps_slug              = 'questions';
74
        $this->_model_chain_to_wp_user = 'Question';
75
76
        // this model is generally available for reading
77
        $this->_cap_restriction_generators[ EEM_Base::caps_read ]       =
78
            new EE_Restriction_Generator_Public();
79
        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] =
80
            new EE_Restriction_Generator_Reg_Form('QSO_system');
81
        $this->_cap_restriction_generators[ EEM_Base::caps_edit ]       =
82
            new EE_Restriction_Generator_Reg_Form('QSO_system');
83
        $this->_cap_restriction_generators[ EEM_Base::caps_delete ]     =
84
            new EE_Restriction_Generator_Reg_Form('QSO_system');
85
86
        parent::__construct($timezone);
87
    }
88
}
89