Completed
Push — master ( bcdba8...408d98 )
by Jan
03:54
created

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