Completed
Push — master ( 424407...314f1e )
by Jan
05:39 queued 32s
created

Category::isDisableProperties()   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
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Part-DB Version 0.4+ "nextgen"
6
 * Copyright (C) 2016 - 2019 Jan Böhmer
7
 * https://github.com/jbtronics.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
22
 */
23
24
namespace App\Entity;
25
26
use Doctrine\ORM\Mapping as ORM;
27
28
/**
29
 * Class AttachmentType.
30
 *
31
 * @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
32
 * @ORM\Table(name="categories")
33
 */
34
class Category extends PartsContainingDBElement
35
{
36
    /**
37
     * @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
38
     */
39
    protected $children;
40
41
    /**
42
     * @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
43
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
44
     */
45
    protected $parent;
46
47
    /**
48
     * @ORM\OneToMany(targetEntity="Part", mappedBy="category")
49
     */
50
    protected $parts;
51
52
    /**
53
     * @var string
54
     * @ORM\Column(type="string")
55
     */
56
    protected $partname_hint = "";
57
58
    /**
59
     * @var string
60
     * @ORM\Column(type="string")
61
     */
62
    protected $partname_regex = "";
63
64
    /**
65
     * @var bool
66
     * @ORM\Column(type="boolean")
67
     */
68
    protected $disable_footprints = false;
69
70
    /**
71
     * @var bool
72
     * @ORM\Column(type="boolean")
73
     */
74
    protected $disable_manufacturers = false;
75
76
    /**
77
     * @var bool
78
     * @ORM\Column(type="boolean")
79
     */
80
    protected $disable_autodatasheets = false;
81
82
    /**
83
     * @var bool
84
     * @ORM\Column(type="boolean")
85
     */
86
    protected $disable_properties = false;
87
88
    /**
89
     * @var string
90
     * @ORM\Column(type="string")
91
     */
92
    protected $default_description = "";
93
94
    /**
95
     * @var string
96
     * @ORM\Column(type="string")
97
     */
98
    protected $default_comment = "";
99
100
    /**
101
     * Returns the ID as an string, defined by the element class.
102
     * This should have a form like P000014, for a part with ID 14.
103
     *
104
     * @return string The ID as a string;
105
     */
106
    public function getIDString(): string
107
    {
108
        return 'C'.sprintf('%09d', $this->getID());
109
    }
110
111
    /**
112
     * @return string
113
     */
114
    public function getPartnameHint(): string
115
    {
116
        return $this->partname_hint;
117
    }
118
119
    /**
120
     * @param string $partname_hint
121
     * @return Category
122
     */
123
    public function setPartnameHint(string $partname_hint): Category
124
    {
125
        $this->partname_hint = $partname_hint;
126
        return $this;
127
    }
128
129
    /**
130
     * @return string
131
     */
132
    public function getPartnameRegex(): string
133
    {
134
        return $this->partname_regex;
135
    }
136
137
    /**
138
     * @param string $partname_regex
139
     * @return Category
140
     */
141
    public function setPartnameRegex(string $partname_regex): Category
142
    {
143
        $this->partname_regex = $partname_regex;
144
        return $this;
145
    }
146
147
    /**
148
     * @return bool
149
     */
150
    public function isDisableFootprints(): bool
151
    {
152
        return $this->disable_footprints;
153
    }
154
155
    /**
156
     * @param bool $disable_footprints
157
     * @return Category
158
     */
159
    public function setDisableFootprints(bool $disable_footprints): Category
160
    {
161
        $this->disable_footprints = $disable_footprints;
162
        return $this;
163
    }
164
165
    /**
166
     * @return bool
167
     */
168
    public function isDisableManufacturers(): bool
169
    {
170
        return $this->disable_manufacturers;
171
    }
172
173
    /**
174
     * @param bool $disable_manufacturers
175
     * @return Category
176
     */
177
    public function setDisableManufacturers(bool $disable_manufacturers): Category
178
    {
179
        $this->disable_manufacturers = $disable_manufacturers;
180
        return $this;
181
    }
182
183
    /**
184
     * @return bool
185
     */
186
    public function isDisableAutodatasheets(): bool
187
    {
188
        return $this->disable_autodatasheets;
189
    }
190
191
    /**
192
     * @param bool $disable_autodatasheets
193
     * @return Category
194
     */
195
    public function setDisableAutodatasheets(bool $disable_autodatasheets): Category
196
    {
197
        $this->disable_autodatasheets = $disable_autodatasheets;
198
        return $this;
199
    }
200
201
    /**
202
     * @return bool
203
     */
204
    public function isDisableProperties(): bool
205
    {
206
        return $this->disable_properties;
207
    }
208
209
    /**
210
     * @param bool $disable_properties
211
     * @return Category
212
     */
213
    public function setDisableProperties(bool $disable_properties): Category
214
    {
215
        $this->disable_properties = $disable_properties;
216
        return $this;
217
    }
218
219
    /**
220
     * @return string
221
     */
222
    public function getDefaultDescription(): string
223
    {
224
        return $this->default_description;
225
    }
226
227
    /**
228
     * @param string $default_description
229
     * @return Category
230
     */
231
    public function setDefaultDescription(string $default_description): Category
232
    {
233
        $this->default_description = $default_description;
234
        return $this;
235
    }
236
237
    /**
238
     * @return string
239
     */
240
    public function getDefaultComment(): string
241
    {
242
        return $this->default_comment;
243
    }
244
245
    /**
246
     * @param string $default_comment
247
     * @return Category
248
     */
249
    public function setDefaultComment(string $default_comment): Category
250
    {
251
        $this->default_comment = $default_comment;
252
        return $this;
253
    }
254
255
256
}
257