|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainFoundation\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Assert\Assert; |
|
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
8
|
|
|
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable; |
|
9
|
|
|
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable; |
|
10
|
|
|
use Knp\DoctrineBehaviors\Model\Translatable\Translatable; |
|
11
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\CategoryInterface; |
|
|
|
|
|
|
12
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\CurrencyInterface; |
|
|
|
|
|
|
13
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ManufacturerInterface; |
|
|
|
|
|
|
14
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\MediumInterface; |
|
|
|
|
|
|
15
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\PriceInterface; |
|
|
|
|
|
|
16
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ProductInterface; |
|
|
|
|
|
|
17
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ProductRelationInterface; |
|
|
|
|
|
|
18
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ProductTrait; |
|
|
|
|
|
|
19
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ProductTranslationInterface; |
|
|
|
|
|
|
20
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\ProductTypeInterface; |
|
|
|
|
|
|
21
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\SegmentInterface; |
|
|
|
|
|
|
22
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\VariantGroupInterface; |
|
|
|
|
|
|
23
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\VariantInterface; |
|
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @ORM\Entity() |
|
27
|
|
|
* @ORM\Table(name="ldf_products", indexes={ |
|
28
|
|
|
* @ORM\Index(name="is_variant_master", columns={"is_variant_master"}) |
|
29
|
|
|
* }, uniqueConstraints={ |
|
30
|
|
|
* @ORM\UniqueConstraint(name="external_id", columns={"external_id"}), |
|
31
|
|
|
* @ORM\UniqueConstraint(name="number", columns={"number"}) |
|
32
|
|
|
* }) |
|
33
|
|
|
* @ORM\HasLifecycleCallbacks() |
|
34
|
|
|
* |
|
35
|
|
|
* @method ProductTranslationInterface translate(string $locale = null, bool $fallbackToDefault = true) |
|
36
|
|
|
*/ |
|
37
|
|
|
class Product extends AbstractEntity implements ProductInterface |
|
38
|
|
|
{ |
|
39
|
|
|
use ProductTrait; |
|
40
|
|
|
use Timestampable; |
|
41
|
|
|
use SoftDeletable; |
|
42
|
|
|
use Translatable; |
|
43
|
|
|
|
|
44
|
|
|
protected $hydrateConversions = [ |
|
45
|
|
|
'id' => 'externalId', |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var int |
|
50
|
|
|
* |
|
51
|
|
|
* @ORM\Id |
|
52
|
|
|
* @ORM\GeneratedValue |
|
53
|
|
|
* @ORM\Column(type="integer") |
|
54
|
|
|
**/ |
|
55
|
|
|
protected $id; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @var int |
|
59
|
|
|
* |
|
60
|
|
|
* @ORM\Column(name="external_id", type="integer", nullable=true) |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $externalId; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @var string|null |
|
66
|
|
|
* |
|
67
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
68
|
|
|
*/ |
|
69
|
|
|
protected $barCodeNumber; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @var array|null |
|
73
|
|
|
* |
|
74
|
|
|
* @ORM\Column(nullable=true, type="json") |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $categoryIdList; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @var string|null |
|
80
|
|
|
* |
|
81
|
|
|
* @ORM\Column(nullable=true, type="text") |
|
82
|
|
|
*/ |
|
83
|
|
|
protected $comments; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @var float|null |
|
87
|
|
|
* |
|
88
|
|
|
* @ORM\Column(nullable=true, type="decimal", precision=12, scale=2) |
|
89
|
|
|
*/ |
|
90
|
|
|
protected $costPrice; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @var \DateTimeImmutable|null |
|
94
|
|
|
* |
|
95
|
|
|
* @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Created info from Dandomain"}) |
|
96
|
|
|
*/ |
|
97
|
|
|
protected $created; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @var string|null |
|
101
|
|
|
* |
|
102
|
|
|
* @ORM\Column(nullable=true, type="string", length=191, options={"comment"="Created by info from Dandomain"}) |
|
103
|
|
|
*/ |
|
104
|
|
|
protected $createdBy; |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @var int|null |
|
108
|
|
|
* |
|
109
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
110
|
|
|
*/ |
|
111
|
|
|
protected $defaultCategoryId; |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @var array|null |
|
115
|
|
|
* |
|
116
|
|
|
* @ORM\Column(nullable=true, type="json") |
|
117
|
|
|
*/ |
|
118
|
|
|
protected $disabledVariantIdList; |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @var string|null |
|
122
|
|
|
* |
|
123
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
124
|
|
|
*/ |
|
125
|
|
|
protected $edbPriserProductNumber; |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @var string|null |
|
129
|
|
|
* |
|
130
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
131
|
|
|
*/ |
|
132
|
|
|
protected $fileSaleLink; |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @var string|null |
|
136
|
|
|
* |
|
137
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
138
|
|
|
*/ |
|
139
|
|
|
protected $googleFeedCategory; |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* @var bool|null |
|
143
|
|
|
* |
|
144
|
|
|
* @ORM\Column(nullable=true, type="boolean") |
|
145
|
|
|
*/ |
|
146
|
|
|
protected $isGiftCertificate; |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* @var bool|null |
|
150
|
|
|
* |
|
151
|
|
|
* @ORM\Column(nullable=true, type="boolean") |
|
152
|
|
|
*/ |
|
153
|
|
|
protected $isModified; |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @var bool|null |
|
157
|
|
|
* |
|
158
|
|
|
* @ORM\Column(nullable=true, type="boolean") |
|
159
|
|
|
*/ |
|
160
|
|
|
protected $isRateVariants; |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* @var bool|null |
|
164
|
|
|
* |
|
165
|
|
|
* @ORM\Column(nullable=true, type="boolean") |
|
166
|
|
|
*/ |
|
167
|
|
|
protected $isReviewVariants; |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @var bool|null |
|
171
|
|
|
* |
|
172
|
|
|
* @ORM\Column(name="is_variant_master", nullable=true, type="boolean") |
|
173
|
|
|
*/ |
|
174
|
|
|
protected $isVariantMaster; |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @var string|null |
|
178
|
|
|
* |
|
179
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
180
|
|
|
*/ |
|
181
|
|
|
protected $locationNumber; |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* @var array|null |
|
185
|
|
|
* |
|
186
|
|
|
* @ORM\Column(nullable=true, type="json") |
|
187
|
|
|
*/ |
|
188
|
|
|
protected $manufacturereIdList; |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* @var int|null |
|
192
|
|
|
* |
|
193
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
194
|
|
|
*/ |
|
195
|
|
|
protected $maxBuyAmount; |
|
196
|
|
|
|
|
197
|
|
|
/** |
|
198
|
|
|
* @var int|null |
|
199
|
|
|
* |
|
200
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
201
|
|
|
*/ |
|
202
|
|
|
protected $minBuyAmount; |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* @var int|null |
|
206
|
|
|
* |
|
207
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
208
|
|
|
*/ |
|
209
|
|
|
protected $minBuyAmountB2B; |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* The product number. |
|
213
|
|
|
* |
|
214
|
|
|
* @var string |
|
215
|
|
|
* |
|
216
|
|
|
* @ORM\Column(name="number", type="string", length=191) |
|
217
|
|
|
*/ |
|
218
|
|
|
protected $number; |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* @var string|null |
|
222
|
|
|
* |
|
223
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
224
|
|
|
*/ |
|
225
|
|
|
protected $picture; |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* @var int|null |
|
229
|
|
|
* |
|
230
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
231
|
|
|
*/ |
|
232
|
|
|
protected $salesCount; |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* @var array|null |
|
236
|
|
|
* |
|
237
|
|
|
* @ORM\Column(nullable=true, type="json") |
|
238
|
|
|
*/ |
|
239
|
|
|
protected $segmentIdList; |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @var int|null |
|
243
|
|
|
* |
|
244
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
245
|
|
|
*/ |
|
246
|
|
|
protected $sortOrder; |
|
247
|
|
|
|
|
248
|
|
|
/** |
|
249
|
|
|
* @var int|null |
|
250
|
|
|
* |
|
251
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
252
|
|
|
*/ |
|
253
|
|
|
protected $stockCount; |
|
254
|
|
|
|
|
255
|
|
|
/** |
|
256
|
|
|
* @var int|null |
|
257
|
|
|
* |
|
258
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
259
|
|
|
*/ |
|
260
|
|
|
protected $stockLimit; |
|
261
|
|
|
|
|
262
|
|
|
/** |
|
263
|
|
|
* @var int|null |
|
264
|
|
|
* |
|
265
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
266
|
|
|
*/ |
|
267
|
|
|
protected $typeId; |
|
268
|
|
|
|
|
269
|
|
|
/** |
|
270
|
|
|
* @var \DateTimeImmutable|null |
|
271
|
|
|
* |
|
272
|
|
|
* @ORM\Column(nullable=true, type="datetime_immutable", options={"comment"="Updated info from Dandomain"}) |
|
273
|
|
|
*/ |
|
274
|
|
|
protected $updated; |
|
275
|
|
|
|
|
276
|
|
|
/** |
|
277
|
|
|
* @var string|null |
|
278
|
|
|
* |
|
279
|
|
|
* @ORM\Column(nullable=true, type="string", length=191, options={"comment"="Updated by info from Dandomain"}) |
|
280
|
|
|
*/ |
|
281
|
|
|
protected $updatedBy; |
|
282
|
|
|
|
|
283
|
|
|
/** |
|
284
|
|
|
* @var array|null |
|
285
|
|
|
* |
|
286
|
|
|
* @ORM\Column(nullable=true, type="json") |
|
287
|
|
|
*/ |
|
288
|
|
|
protected $variantGroupIdList; |
|
289
|
|
|
|
|
290
|
|
|
/** |
|
291
|
|
|
* @var array|null |
|
292
|
|
|
* |
|
293
|
|
|
* @ORM\Column(nullable=true, type="json") |
|
294
|
|
|
*/ |
|
295
|
|
|
protected $variantIdList; |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* @var int|null |
|
299
|
|
|
* |
|
300
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
301
|
|
|
*/ |
|
302
|
|
|
protected $variantMasterId; |
|
303
|
|
|
|
|
304
|
|
|
/** |
|
305
|
|
|
* @var string|null |
|
306
|
|
|
* |
|
307
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
|
308
|
|
|
*/ |
|
309
|
|
|
protected $vendorNumber; |
|
310
|
|
|
|
|
311
|
|
|
/** |
|
312
|
|
|
* @var int|null |
|
313
|
|
|
* |
|
314
|
|
|
* @ORM\Column(nullable=true, type="integer") |
|
315
|
|
|
*/ |
|
316
|
|
|
protected $weight; |
|
317
|
|
|
|
|
318
|
|
|
/** |
|
319
|
|
|
* @var Category[]|ArrayCollection |
|
320
|
|
|
* |
|
321
|
|
|
* @ORM\ManyToMany(targetEntity="Category", inversedBy="products", cascade={"persist"}) |
|
322
|
|
|
* @ORM\JoinTable(name="ldf_products_categories") |
|
323
|
|
|
*/ |
|
324
|
|
|
protected $categories; |
|
325
|
|
|
|
|
326
|
|
|
/** |
|
327
|
|
|
* @var Variant[]|ArrayCollection |
|
328
|
|
|
*/ |
|
329
|
|
|
protected $disabledVariants; |
|
330
|
|
|
|
|
331
|
|
|
/** |
|
332
|
|
|
* @var Manufacturer[]|ArrayCollection |
|
333
|
|
|
* |
|
334
|
|
|
* @ORM\ManyToMany(inversedBy="products", targetEntity="Manufacturer", cascade={"persist"}) |
|
335
|
|
|
* @ORM\JoinTable(name="ldf_product_manufacturer") |
|
336
|
|
|
*/ |
|
337
|
|
|
protected $manufacturers; |
|
338
|
|
|
|
|
339
|
|
|
/** |
|
340
|
|
|
* @var Medium[]|ArrayCollection |
|
341
|
|
|
*/ |
|
342
|
|
|
protected $media; |
|
343
|
|
|
|
|
344
|
|
|
/** |
|
345
|
|
|
* @var PriceInterface[]|ArrayCollection |
|
346
|
|
|
* |
|
347
|
|
|
* @ORM\OneToMany(targetEntity="Price", mappedBy="product", cascade={"persist", "remove"}, orphanRemoval=true) |
|
348
|
|
|
*/ |
|
349
|
|
|
protected $prices; |
|
350
|
|
|
|
|
351
|
|
|
/** |
|
352
|
|
|
* @var ProductRelation[]|ArrayCollection |
|
353
|
|
|
*/ |
|
354
|
|
|
protected $productRelations; |
|
355
|
|
|
|
|
356
|
|
|
/** |
|
357
|
|
|
* @var ProductType |
|
358
|
|
|
*/ |
|
359
|
|
|
protected $productType; |
|
360
|
|
|
|
|
361
|
|
|
/** |
|
362
|
|
|
* @var Segment[]|ArrayCollection |
|
363
|
|
|
*/ |
|
364
|
|
|
protected $segments; |
|
365
|
|
|
|
|
366
|
|
|
/** |
|
367
|
|
|
* @var VariantGroup[]|ArrayCollection |
|
368
|
|
|
* |
|
369
|
|
|
* @ORM\JoinTable(name="ldf_product_variant_group") |
|
370
|
|
|
* @ORM\ManyToMany(cascade={"persist"}, inversedBy="products", targetEntity="VariantGroup") |
|
371
|
|
|
*/ |
|
372
|
|
|
protected $variantGroups; |
|
373
|
|
|
|
|
374
|
|
|
/** |
|
375
|
|
|
* @var Variant[]|ArrayCollection |
|
376
|
|
|
*/ |
|
377
|
|
|
protected $variants; |
|
378
|
|
|
|
|
379
|
|
|
/** |
|
380
|
|
|
* This is the master for this product. |
|
381
|
|
|
* |
|
382
|
|
|
* @var Product|null |
|
383
|
|
|
* |
|
384
|
|
|
* @ORM\ManyToOne(targetEntity="Product", inversedBy="children") |
|
385
|
|
|
*/ |
|
386
|
|
|
protected $parent; |
|
387
|
|
|
|
|
388
|
|
|
/** |
|
389
|
|
|
* This is the children (i.e. variants) of this products. |
|
390
|
12 |
|
* |
|
391
|
|
|
* @var Product[]|ArrayCollection |
|
392
|
12 |
|
* |
|
393
|
12 |
|
* @ORM\OneToMany(targetEntity="Product", mappedBy="parent") |
|
394
|
12 |
|
*/ |
|
395
|
12 |
|
protected $children; |
|
396
|
12 |
|
|
|
397
|
12 |
|
public function __construct() |
|
398
|
12 |
|
{ |
|
399
|
12 |
|
$this->categories = new ArrayCollection(); |
|
400
|
12 |
|
$this->disabledVariants = new ArrayCollection(); |
|
401
|
12 |
|
$this->manufacturers = new ArrayCollection(); |
|
402
|
12 |
|
$this->media = new ArrayCollection(); |
|
403
|
|
|
$this->prices = new ArrayCollection(); |
|
404
|
|
|
$this->productRelations = new ArrayCollection(); |
|
405
|
|
|
$this->segments = new ArrayCollection(); |
|
406
|
|
|
$this->variants = new ArrayCollection(); |
|
407
|
|
|
$this->variantGroups = new ArrayCollection(); |
|
408
|
|
|
$this->children = new ArrayCollection(); |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
public function __toString() |
|
412
|
|
|
{ |
|
413
|
|
|
return (string) $this->number; |
|
414
|
|
|
} |
|
415
|
|
|
|
|
416
|
|
|
/** |
|
417
|
|
|
* @ORM\PrePersist() |
|
418
|
|
|
* @ORM\PreUpdate() |
|
419
|
|
|
*/ |
|
420
|
|
|
public function validate() |
|
421
|
|
|
{ |
|
422
|
|
|
Assert::that($this->number) |
|
423
|
|
|
->string('The number needs to be string', 'number') |
|
424
|
|
|
->maxLength(191, 'The number must have a max length of 191'); |
|
425
|
3 |
|
Assert::thatNullOr($this->externalId)->integer('['.$this->number.'] The external id can only be null or an integer', 'externalId'); |
|
426
|
|
|
|
|
427
|
3 |
|
if (is_null($this->externalId)) { |
|
|
|
|
|
|
428
|
3 |
|
Assert::that($this->isDeleted())->true('['.$this->number.'] The external id can only be null if the product is marked as deleted', 'externalId'); |
|
429
|
|
|
} |
|
430
|
|
|
} |
|
431
|
3 |
|
|
|
432
|
3 |
|
public function hydrate(array $data, bool $useConversions = false, $scalarsOnly = true) |
|
433
|
|
|
{ |
|
434
|
|
|
if (isset($data['created'])) { |
|
435
|
3 |
|
$data['created'] = $this->getDateTimeFromJson($data['created']); |
|
436
|
3 |
|
} |
|
437
|
|
|
|
|
438
|
|
|
if (isset($data['updated'])) { |
|
439
|
|
|
$data['updated'] = $this->getDateTimeFromJson($data['updated']); |
|
440
|
|
|
} |
|
441
|
|
|
|
|
442
|
|
|
parent::hydrate($data, $useConversions, $scalarsOnly); |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
/* |
|
446
|
|
|
* Collection/relation methods |
|
447
|
|
|
*/ |
|
448
|
|
|
|
|
449
|
|
|
public function addDisabledVariant(VariantInterface $variant): ProductInterface |
|
450
|
|
|
{ |
|
451
|
|
|
if (!$this->disabledVariants->contains($variant)) { |
|
452
|
|
|
$this->disabledVariants->add($variant); |
|
453
|
|
|
} |
|
454
|
|
|
|
|
455
|
|
|
return $this; |
|
456
|
|
|
} |
|
457
|
|
|
|
|
458
|
|
|
public function addMedium(MediumInterface $medium): ProductInterface |
|
459
|
|
|
{ |
|
460
|
|
|
if (!$this->media->contains($medium)) { |
|
461
|
|
|
$this->media->add($medium); |
|
462
|
|
|
} |
|
463
|
|
|
|
|
464
|
|
|
return $this; |
|
465
|
|
|
} |
|
466
|
|
|
|
|
467
|
|
|
/* |
|
468
|
|
|
* Category collection methods |
|
469
|
|
|
*/ |
|
470
|
|
|
public function addCategory(CategoryInterface $category): ProductInterface |
|
471
|
|
|
{ |
|
472
|
|
|
if (!$this->categories->contains($category)) { |
|
473
|
|
|
$this->categories->add($category); |
|
474
|
|
|
} |
|
475
|
|
|
|
|
476
|
|
|
return $this; |
|
477
|
|
|
} |
|
478
|
|
|
|
|
479
|
|
|
/** |
|
480
|
|
|
* @param CategoryInterface[] $categories |
|
481
|
|
|
*/ |
|
482
|
|
|
public function updateCategories(array $categories): void |
|
483
|
|
|
{ |
|
484
|
|
|
if(empty($categories)) { |
|
485
|
|
|
$this->clearCategories(); |
|
486
|
|
|
return; |
|
487
|
|
|
} |
|
488
|
|
|
|
|
489
|
|
|
// this holds the final array of categories, whether updated or added |
|
490
|
|
|
$final = []; |
|
491
|
|
|
|
|
492
|
|
|
foreach ($categories as $category) { |
|
493
|
|
|
$existing = $this->findCategory($category); |
|
494
|
|
|
|
|
495
|
|
|
if ($existing) { |
|
496
|
|
|
$final[] = $existing; |
|
497
|
|
|
} else { |
|
498
|
|
|
$this->addCategory($category); |
|
499
|
|
|
$final[] = $category; |
|
500
|
|
|
} |
|
501
|
|
|
} |
|
502
|
|
|
|
|
503
|
|
|
foreach ($this->categories as $category) { |
|
504
|
|
|
if (!in_array($category, $final, true)) { |
|
505
|
|
|
$this->removeCategory($category); |
|
506
|
|
|
} |
|
507
|
|
|
} |
|
508
|
|
|
} |
|
509
|
|
|
|
|
510
|
|
|
public function removeCategory(CategoryInterface $category): bool |
|
511
|
|
|
{ |
|
512
|
|
|
return $this->categories->removeElement($category); |
|
513
|
|
|
} |
|
514
|
|
|
|
|
515
|
|
|
public function clearCategories() : void |
|
516
|
|
|
{ |
|
517
|
|
|
$this->categories->clear(); |
|
518
|
|
|
} |
|
519
|
|
|
|
|
520
|
|
|
/** |
|
521
|
|
|
* This method will try to find a category based on the number (which is unique) |
|
522
|
|
|
* Returns null if it does not exist |
|
523
|
|
|
* |
|
524
|
|
|
* @param CategoryInterface $searchCategory |
|
525
|
|
|
* |
|
526
|
|
|
* @return CategoryInterface|null |
|
527
|
|
|
*/ |
|
528
|
|
|
public function findCategory(CategoryInterface $searchCategory): ?CategoryInterface |
|
529
|
|
|
{ |
|
530
|
|
|
foreach ($this->categories as $category) { |
|
531
|
|
|
if($category->getNumber() === $searchCategory->getNumber()) { |
|
532
|
|
|
return $category; |
|
533
|
|
|
} |
|
534
|
|
|
} |
|
535
|
|
|
|
|
536
|
|
|
return null; |
|
537
|
|
|
} |
|
538
|
|
|
|
|
539
|
|
|
/* |
|
540
|
|
|
* Manufacturer collection methods |
|
541
|
|
|
*/ |
|
542
|
|
|
public function addManufacturer(ManufacturerInterface $manufacturer): ProductInterface |
|
543
|
|
|
{ |
|
544
|
|
|
if (!$this->hasManufacturer($manufacturer)) { |
|
545
|
|
|
$this->manufacturers->add($manufacturer); |
|
546
|
|
|
} |
|
547
|
|
|
|
|
548
|
|
|
return $this; |
|
549
|
|
|
} |
|
550
|
|
|
|
|
551
|
|
|
public function removeManufacturer(ManufacturerInterface $manufacturer): bool |
|
552
|
|
|
{ |
|
553
|
|
|
return $this->manufacturers->removeElement($manufacturer); |
|
554
|
|
|
} |
|
555
|
|
|
|
|
556
|
|
|
public function hasManufacturer(ManufacturerInterface $manufacturer): bool |
|
557
|
|
|
{ |
|
558
|
|
|
return $this->manufacturers->exists(function ($key, ManufacturerInterface $element) use ($manufacturer) { |
|
559
|
|
|
return $element->getExternalId() === $manufacturer->getExternalId(); |
|
560
|
|
|
}); |
|
561
|
|
|
} |
|
562
|
|
|
|
|
563
|
|
|
public function clearManufacturers() : void |
|
564
|
|
|
{ |
|
565
|
|
|
$this->manufacturers->clear(); |
|
566
|
|
|
} |
|
567
|
|
|
|
|
568
|
|
|
/* |
|
569
|
|
|
* Variant group collection methods |
|
570
|
|
|
*/ |
|
571
|
|
|
public function addVariantGroup(VariantGroupInterface $variantGroup): ProductInterface |
|
572
|
|
|
{ |
|
573
|
|
|
if (!$this->hasVariantGroup($variantGroup)) { |
|
574
|
|
|
$this->variantGroups->add($variantGroup); |
|
575
|
|
|
} |
|
576
|
|
|
|
|
577
|
|
|
return $this; |
|
578
|
|
|
} |
|
579
|
|
|
|
|
580
|
|
|
public function removeVariantGroup(VariantGroupInterface $variantGroup): bool |
|
581
|
|
|
{ |
|
582
|
|
|
return $this->variantGroups->removeElement($variantGroup); |
|
583
|
|
|
} |
|
584
|
6 |
|
|
|
585
|
|
|
public function clearVariantGroups() : void |
|
586
|
6 |
|
{ |
|
587
|
|
|
$this->variantGroups->clear(); |
|
588
|
|
|
} |
|
589
|
|
|
|
|
590
|
|
|
public function hasVariantGroup($variantGroup): bool |
|
591
|
|
|
{ |
|
592
|
|
|
if ($variantGroup instanceof VariantGroupInterface) { |
|
593
|
3 |
|
$variantGroup = $variantGroup->getExternalId(); |
|
594
|
|
|
} |
|
595
|
3 |
|
|
|
596
|
3 |
|
return $this->variantGroups->exists(function ($key, VariantGroupInterface $element) use ($variantGroup) { |
|
597
|
|
|
return $element->getExternalId() === $variantGroup; |
|
598
|
|
|
}); |
|
599
|
|
|
} |
|
600
|
|
|
|
|
601
|
|
|
/* |
|
602
|
6 |
|
* Price collection methods |
|
603
|
|
|
*/ |
|
604
|
6 |
|
public function addPrice(PriceInterface $price): ProductInterface |
|
605
|
|
|
{ |
|
606
|
|
|
if (!$this->prices->contains($price)) { |
|
607
|
|
|
$this->prices->add($price); |
|
608
|
|
|
$price->setProduct($this); |
|
609
|
|
|
} |
|
610
|
|
|
|
|
611
|
3 |
|
return $this; |
|
612
|
|
|
} |
|
613
|
3 |
|
|
|
614
|
3 |
|
/** |
|
615
|
|
|
* @param PriceInterface[] $prices |
|
616
|
|
|
*/ |
|
617
|
|
|
public function updatePrices(array $prices): void |
|
618
|
|
|
{ |
|
619
|
|
|
// this holds the final array of prices, whether updated or added |
|
620
|
3 |
|
$finalPrices = []; |
|
621
|
|
|
|
|
622
|
3 |
|
foreach ($prices as $price) { |
|
623
|
|
|
$existingPrice = $this->findPrice($price); |
|
624
|
|
|
|
|
625
|
|
|
if ($existingPrice) { |
|
626
|
|
|
$existingPrice->copyProperties($price); |
|
627
|
|
|
$existingPrice->setProduct($this); |
|
628
|
|
|
$finalPrices[] = $existingPrice; |
|
629
|
3 |
|
} else { |
|
630
|
|
|
$this->addPrice($price); |
|
631
|
3 |
|
$price->setProduct($this); |
|
632
|
3 |
|
$finalPrices[] = $price; |
|
633
|
|
|
} |
|
634
|
|
|
} |
|
635
|
|
|
|
|
636
|
|
|
foreach ($this->prices as $price) { |
|
637
|
|
|
if (!in_array($price, $finalPrices, true)) { |
|
638
|
|
|
$this->removePrice($price); |
|
639
|
|
|
} |
|
640
|
|
|
} |
|
641
|
|
|
} |
|
642
|
|
|
|
|
643
|
|
|
public function removePrice(PriceInterface $price): bool |
|
644
|
|
|
{ |
|
645
|
|
|
$price->setProduct(null); |
|
646
|
|
|
|
|
647
|
|
|
return $this->prices->removeElement($price); |
|
648
|
|
|
} |
|
649
|
|
|
|
|
650
|
|
|
public function clearPrices() : void |
|
651
|
|
|
{ |
|
652
|
|
|
foreach ($this->prices as $price) { |
|
653
|
|
|
$price->setProduct(null); |
|
654
|
|
|
} |
|
655
|
|
|
|
|
656
|
3 |
|
$this->prices->clear(); |
|
657
|
|
|
} |
|
658
|
3 |
|
|
|
659
|
|
|
/** |
|
660
|
|
|
* Will try to find a price based on currency. |
|
661
|
|
|
* |
|
662
|
|
|
* @param string|\Money\Currency|CurrencyInterface $currency |
|
663
|
|
|
* |
|
664
|
|
|
* @return PriceInterface|null |
|
665
|
3 |
|
*/ |
|
666
|
|
|
public function findPriceByCurrency($currency): ?PriceInterface |
|
667
|
3 |
|
{ |
|
668
|
3 |
|
if ($currency instanceof \Money\Currency) { |
|
669
|
|
|
$currency = $currency->getCode(); |
|
670
|
|
|
} elseif ($currency instanceof CurrencyInterface) { |
|
|
|
|
|
|
671
|
|
|
$currency = $currency->getIsoCodeAlpha(); |
|
672
|
|
|
} |
|
673
|
|
|
|
|
674
|
3 |
|
if (!is_string($currency)) { |
|
|
|
|
|
|
675
|
|
|
throw new \InvalidArgumentException('$currency has to be a string'); |
|
676
|
3 |
|
} |
|
677
|
|
|
|
|
678
|
|
|
foreach ($this->prices as $price) { |
|
679
|
|
|
if ($price->getCurrency()->getIsoCodeAlpha() === $currency) { |
|
680
|
|
|
return $price; |
|
681
|
|
|
} |
|
682
|
|
|
} |
|
683
|
3 |
|
|
|
684
|
|
|
return null; |
|
685
|
3 |
|
} |
|
686
|
3 |
|
|
|
687
|
|
|
public function addProductRelation(ProductRelationInterface $productRelation): ProductInterface |
|
688
|
|
|
{ |
|
689
|
|
|
if (!$this->productRelations->contains($productRelation)) { |
|
690
|
|
|
$this->productRelations->add($productRelation); |
|
691
|
|
|
} |
|
692
|
3 |
|
|
|
693
|
|
|
return $this; |
|
694
|
3 |
|
} |
|
695
|
|
|
|
|
696
|
|
|
public function addSegment(SegmentInterface $segment): ProductInterface |
|
697
|
|
|
{ |
|
698
|
|
|
if (!$this->segments->contains($segment)) { |
|
699
|
|
|
$this->segments->add($segment); |
|
700
|
|
|
} |
|
701
|
3 |
|
|
|
702
|
|
|
return $this; |
|
703
|
3 |
|
} |
|
704
|
3 |
|
|
|
705
|
|
|
public function addVariant(VariantInterface $variant): ProductInterface |
|
706
|
|
|
{ |
|
707
|
|
|
if (!$this->variants->contains($variant)) { |
|
708
|
|
|
$this->variants->add($variant); |
|
709
|
|
|
} |
|
710
|
3 |
|
|
|
711
|
|
|
return $this; |
|
712
|
3 |
|
} |
|
713
|
|
|
|
|
714
|
|
|
public function addChild(ProductInterface $product): ProductInterface |
|
715
|
|
|
{ |
|
716
|
|
|
if (!$this->hasChild($product)) { |
|
717
|
|
|
$this->children->add($product); |
|
718
|
|
|
$product->setParent($this); |
|
719
|
3 |
|
} |
|
720
|
|
|
|
|
721
|
3 |
|
return $this; |
|
722
|
3 |
|
} |
|
723
|
|
|
|
|
724
|
|
|
public function removeChild(ProductInterface $product): bool |
|
725
|
|
|
{ |
|
726
|
|
|
$product->setParent(null); |
|
727
|
|
|
|
|
728
|
3 |
|
return $this->children->removeElement($product); |
|
729
|
|
|
} |
|
730
|
3 |
|
|
|
731
|
|
|
public function hasChild($product): bool |
|
732
|
|
|
{ |
|
733
|
|
|
if ($product instanceof ProductInterface) { |
|
734
|
|
|
$product = $product->getExternalId(); |
|
735
|
|
|
} |
|
736
|
|
|
|
|
737
|
3 |
|
return $this->children->exists(function ($key, ProductInterface $element) use ($product) { |
|
738
|
|
|
return $element->getExternalId() === $product; |
|
739
|
3 |
|
}); |
|
740
|
3 |
|
} |
|
741
|
|
|
|
|
742
|
|
|
/* |
|
743
|
|
|
* Getters / Setters |
|
744
|
|
|
*/ |
|
745
|
|
|
|
|
746
|
|
|
/** |
|
747
|
|
|
* @return int |
|
748
|
|
|
*/ |
|
749
|
|
|
public function getId(): int |
|
750
|
|
|
{ |
|
751
|
|
|
return (int) $this->id; |
|
752
|
|
|
} |
|
753
|
|
|
|
|
754
|
|
|
/** |
|
755
|
|
|
* @param int $id |
|
756
|
|
|
* |
|
757
|
|
|
* @return ProductInterface |
|
758
|
|
|
*/ |
|
759
|
|
|
public function setId(int $id) |
|
760
|
|
|
{ |
|
761
|
|
|
$this->id = $id; |
|
762
|
|
|
|
|
763
|
|
|
return $this; |
|
764
|
3 |
|
} |
|
765
|
|
|
|
|
766
|
3 |
|
/** |
|
767
|
|
|
* @return int |
|
768
|
|
|
*/ |
|
769
|
|
|
public function getExternalId(): int |
|
770
|
|
|
{ |
|
771
|
|
|
return (int) $this->externalId; |
|
772
|
|
|
} |
|
773
|
3 |
|
|
|
774
|
|
|
/** |
|
775
|
3 |
|
* @param int $externalId |
|
776
|
3 |
|
* |
|
777
|
|
|
* @return ProductInterface |
|
778
|
|
|
*/ |
|
779
|
|
|
public function setExternalId(int $externalId) |
|
780
|
|
|
{ |
|
781
|
|
|
$this->externalId = $externalId; |
|
782
|
3 |
|
|
|
783
|
|
|
return $this; |
|
784
|
3 |
|
} |
|
785
|
|
|
|
|
786
|
|
|
/** |
|
787
|
|
|
* @return null|string |
|
788
|
|
|
*/ |
|
789
|
|
|
public function getBarCodeNumber() |
|
790
|
|
|
{ |
|
791
|
3 |
|
return $this->barCodeNumber; |
|
792
|
|
|
} |
|
793
|
3 |
|
|
|
794
|
3 |
|
/** |
|
795
|
|
|
* @param null|string $barCodeNumber |
|
796
|
|
|
* |
|
797
|
|
|
* @return ProductInterface |
|
798
|
|
|
*/ |
|
799
|
|
|
public function setBarCodeNumber($barCodeNumber) |
|
800
|
3 |
|
{ |
|
801
|
|
|
$this->barCodeNumber = $barCodeNumber; |
|
802
|
3 |
|
|
|
803
|
|
|
return $this; |
|
804
|
|
|
} |
|
805
|
|
|
|
|
806
|
|
|
/** |
|
807
|
|
|
* @return array|null |
|
808
|
|
|
*/ |
|
809
|
3 |
|
public function getCategoryIdList() |
|
810
|
|
|
{ |
|
811
|
3 |
|
return $this->categoryIdList; |
|
812
|
3 |
|
} |
|
813
|
|
|
|
|
814
|
|
|
/** |
|
815
|
|
|
* @param array|null $categoryIdList |
|
816
|
|
|
* |
|
817
|
|
|
* @return ProductInterface |
|
818
|
3 |
|
*/ |
|
819
|
|
|
public function setCategoryIdList($categoryIdList) |
|
820
|
3 |
|
{ |
|
821
|
|
|
$this->categoryIdList = $categoryIdList; |
|
822
|
|
|
|
|
823
|
|
|
return $this; |
|
824
|
|
|
} |
|
825
|
|
|
|
|
826
|
|
|
/** |
|
827
|
3 |
|
* @return null|string |
|
828
|
|
|
*/ |
|
829
|
3 |
|
public function getComments() |
|
830
|
3 |
|
{ |
|
831
|
|
|
return $this->comments; |
|
832
|
|
|
} |
|
833
|
|
|
|
|
834
|
|
|
/** |
|
835
|
|
|
* @param null|string $comments |
|
836
|
3 |
|
* |
|
837
|
|
|
* @return ProductInterface |
|
838
|
3 |
|
*/ |
|
839
|
|
|
public function setComments($comments) |
|
840
|
|
|
{ |
|
841
|
|
|
$this->comments = $comments; |
|
842
|
|
|
|
|
843
|
|
|
return $this; |
|
844
|
|
|
} |
|
845
|
3 |
|
|
|
846
|
|
|
/** |
|
847
|
3 |
|
* @return float|null |
|
848
|
3 |
|
*/ |
|
849
|
|
|
public function getCostPrice() |
|
850
|
|
|
{ |
|
851
|
|
|
return $this->costPrice; |
|
852
|
|
|
} |
|
853
|
|
|
|
|
854
|
3 |
|
/** |
|
855
|
|
|
* @param float|null $costPrice |
|
856
|
3 |
|
* |
|
857
|
|
|
* @return ProductInterface |
|
858
|
|
|
*/ |
|
859
|
|
|
public function setCostPrice($costPrice) |
|
860
|
|
|
{ |
|
861
|
|
|
$this->costPrice = $costPrice; |
|
862
|
|
|
|
|
863
|
3 |
|
return $this; |
|
864
|
|
|
} |
|
865
|
3 |
|
|
|
866
|
3 |
|
/** |
|
867
|
|
|
* @return \DateTimeImmutable|null |
|
868
|
|
|
*/ |
|
869
|
|
|
public function getCreated() |
|
870
|
|
|
{ |
|
871
|
|
|
return $this->created; |
|
872
|
3 |
|
} |
|
873
|
|
|
|
|
874
|
3 |
|
/** |
|
875
|
|
|
* @param \DateTimeImmutable|null $created |
|
876
|
|
|
* |
|
877
|
|
|
* @return ProductInterface |
|
878
|
|
|
*/ |
|
879
|
|
|
public function setCreated($created) |
|
880
|
|
|
{ |
|
881
|
3 |
|
$this->created = $created; |
|
882
|
|
|
|
|
883
|
3 |
|
return $this; |
|
884
|
3 |
|
} |
|
885
|
|
|
|
|
886
|
|
|
/** |
|
887
|
|
|
* @return null|string |
|
888
|
|
|
*/ |
|
889
|
|
|
public function getCreatedBy() |
|
890
|
3 |
|
{ |
|
891
|
|
|
return $this->createdBy; |
|
892
|
3 |
|
} |
|
893
|
|
|
|
|
894
|
|
|
/** |
|
895
|
|
|
* @param null|string $createdBy |
|
896
|
|
|
* |
|
897
|
|
|
* @return ProductInterface |
|
898
|
|
|
*/ |
|
899
|
3 |
|
public function setCreatedBy($createdBy) |
|
900
|
|
|
{ |
|
901
|
3 |
|
$this->createdBy = $createdBy; |
|
902
|
3 |
|
|
|
903
|
|
|
return $this; |
|
904
|
|
|
} |
|
905
|
|
|
|
|
906
|
|
|
/** |
|
907
|
|
|
* @return int|null |
|
908
|
3 |
|
*/ |
|
909
|
|
|
public function getDefaultCategoryId() |
|
910
|
3 |
|
{ |
|
911
|
|
|
return $this->defaultCategoryId; |
|
912
|
|
|
} |
|
913
|
|
|
|
|
914
|
|
|
/** |
|
915
|
|
|
* @param int|null $defaultCategoryId |
|
916
|
|
|
* |
|
917
|
3 |
|
* @return ProductInterface |
|
918
|
|
|
*/ |
|
919
|
3 |
|
public function setDefaultCategoryId($defaultCategoryId) |
|
920
|
3 |
|
{ |
|
921
|
|
|
$this->defaultCategoryId = $defaultCategoryId; |
|
922
|
|
|
|
|
923
|
|
|
return $this; |
|
924
|
|
|
} |
|
925
|
|
|
|
|
926
|
|
|
/** |
|
927
|
|
|
* @return array|null |
|
928
|
|
|
*/ |
|
929
|
|
|
public function getDisabledVariantIdList() |
|
930
|
|
|
{ |
|
931
|
|
|
return $this->disabledVariantIdList; |
|
932
|
|
|
} |
|
933
|
|
|
|
|
934
|
|
|
/** |
|
935
|
|
|
* @param array|null $disabledVariantIdList |
|
936
|
|
|
* |
|
937
|
|
|
* @return ProductInterface |
|
938
|
|
|
*/ |
|
939
|
|
|
public function setDisabledVariantIdList($disabledVariantIdList) |
|
940
|
|
|
{ |
|
941
|
|
|
$this->disabledVariantIdList = $disabledVariantIdList; |
|
942
|
|
|
|
|
943
|
|
|
return $this; |
|
944
|
3 |
|
} |
|
945
|
|
|
|
|
946
|
3 |
|
/** |
|
947
|
|
|
* @return null|string |
|
948
|
|
|
*/ |
|
949
|
|
|
public function getEdbPriserProductNumber() |
|
950
|
|
|
{ |
|
951
|
|
|
return $this->edbPriserProductNumber; |
|
952
|
|
|
} |
|
953
|
3 |
|
|
|
954
|
|
|
/** |
|
955
|
3 |
|
* @param null|string $edbPriserProductNumber |
|
956
|
3 |
|
* |
|
957
|
|
|
* @return ProductInterface |
|
958
|
|
|
*/ |
|
959
|
|
|
public function setEdbPriserProductNumber($edbPriserProductNumber) |
|
960
|
|
|
{ |
|
961
|
|
|
$this->edbPriserProductNumber = $edbPriserProductNumber; |
|
962
|
3 |
|
|
|
963
|
|
|
return $this; |
|
964
|
3 |
|
} |
|
965
|
|
|
|
|
966
|
|
|
/** |
|
967
|
|
|
* @return null|string |
|
968
|
|
|
*/ |
|
969
|
|
|
public function getFileSaleLink() |
|
970
|
|
|
{ |
|
971
|
3 |
|
return $this->fileSaleLink; |
|
972
|
|
|
} |
|
973
|
3 |
|
|
|
974
|
3 |
|
/** |
|
975
|
|
|
* @param null|string $fileSaleLink |
|
976
|
|
|
* |
|
977
|
|
|
* @return ProductInterface |
|
978
|
|
|
*/ |
|
979
|
|
|
public function setFileSaleLink($fileSaleLink) |
|
980
|
3 |
|
{ |
|
981
|
|
|
$this->fileSaleLink = $fileSaleLink; |
|
982
|
3 |
|
|
|
983
|
|
|
return $this; |
|
984
|
|
|
} |
|
985
|
|
|
|
|
986
|
|
|
/** |
|
987
|
|
|
* @return null|string |
|
988
|
|
|
*/ |
|
989
|
3 |
|
public function getGoogleFeedCategory() |
|
990
|
|
|
{ |
|
991
|
3 |
|
return $this->googleFeedCategory; |
|
992
|
3 |
|
} |
|
993
|
|
|
|
|
994
|
|
|
/** |
|
995
|
|
|
* @param null|string $googleFeedCategory |
|
996
|
|
|
* |
|
997
|
|
|
* @return ProductInterface |
|
998
|
3 |
|
*/ |
|
999
|
|
|
public function setGoogleFeedCategory($googleFeedCategory) |
|
1000
|
3 |
|
{ |
|
1001
|
|
|
$this->googleFeedCategory = $googleFeedCategory; |
|
1002
|
|
|
|
|
1003
|
|
|
return $this; |
|
1004
|
|
|
} |
|
1005
|
|
|
|
|
1006
|
|
|
/** |
|
1007
|
3 |
|
* @return bool|null |
|
1008
|
|
|
*/ |
|
1009
|
3 |
|
public function getIsGiftCertificate() |
|
1010
|
3 |
|
{ |
|
1011
|
|
|
return $this->isGiftCertificate; |
|
1012
|
|
|
} |
|
1013
|
|
|
|
|
1014
|
|
|
/** |
|
1015
|
|
|
* @param bool|null $isGiftCertificate |
|
1016
|
3 |
|
* |
|
1017
|
|
|
* @return ProductInterface |
|
1018
|
3 |
|
*/ |
|
1019
|
|
|
public function setIsGiftCertificate($isGiftCertificate) |
|
1020
|
|
|
{ |
|
1021
|
|
|
$this->isGiftCertificate = $isGiftCertificate; |
|
1022
|
|
|
|
|
1023
|
|
|
return $this; |
|
1024
|
|
|
} |
|
1025
|
3 |
|
|
|
1026
|
|
|
/** |
|
1027
|
3 |
|
* @return bool|null |
|
1028
|
3 |
|
*/ |
|
1029
|
|
|
public function getIsModified() |
|
1030
|
|
|
{ |
|
1031
|
|
|
return $this->isModified; |
|
1032
|
|
|
} |
|
1033
|
|
|
|
|
1034
|
3 |
|
/** |
|
1035
|
|
|
* @param bool|null $isModified |
|
1036
|
3 |
|
* |
|
1037
|
|
|
* @return ProductInterface |
|
1038
|
|
|
*/ |
|
1039
|
|
|
public function setIsModified($isModified) |
|
1040
|
|
|
{ |
|
1041
|
|
|
$this->isModified = $isModified; |
|
1042
|
|
|
|
|
1043
|
3 |
|
return $this; |
|
1044
|
|
|
} |
|
1045
|
3 |
|
|
|
1046
|
3 |
|
/** |
|
1047
|
|
|
* @return bool|null |
|
1048
|
|
|
*/ |
|
1049
|
|
|
public function getIsRateVariants() |
|
1050
|
|
|
{ |
|
1051
|
|
|
return $this->isRateVariants; |
|
1052
|
|
|
} |
|
1053
|
|
|
|
|
1054
|
|
|
/** |
|
1055
|
|
|
* @param bool|null $isRateVariants |
|
1056
|
|
|
* |
|
1057
|
|
|
* @return ProductInterface |
|
1058
|
|
|
*/ |
|
1059
|
|
|
public function setIsRateVariants($isRateVariants) |
|
1060
|
|
|
{ |
|
1061
|
|
|
$this->isRateVariants = $isRateVariants; |
|
1062
|
|
|
|
|
1063
|
|
|
return $this; |
|
1064
|
|
|
} |
|
1065
|
|
|
|
|
1066
|
|
|
/** |
|
1067
|
|
|
* @return bool|null |
|
1068
|
|
|
*/ |
|
1069
|
|
|
public function getIsReviewVariants() |
|
1070
|
3 |
|
{ |
|
1071
|
|
|
return $this->isReviewVariants; |
|
1072
|
3 |
|
} |
|
1073
|
|
|
|
|
1074
|
|
|
/** |
|
1075
|
|
|
* @param bool|null $isReviewVariants |
|
1076
|
|
|
* |
|
1077
|
|
|
* @return ProductInterface |
|
1078
|
|
|
*/ |
|
1079
|
3 |
|
public function setIsReviewVariants($isReviewVariants) |
|
1080
|
|
|
{ |
|
1081
|
3 |
|
$this->isReviewVariants = $isReviewVariants; |
|
1082
|
3 |
|
|
|
1083
|
|
|
return $this; |
|
1084
|
|
|
} |
|
1085
|
|
|
|
|
1086
|
|
|
/** |
|
1087
|
|
|
* @return bool|null |
|
1088
|
3 |
|
*/ |
|
1089
|
|
|
public function getIsVariantMaster() |
|
1090
|
3 |
|
{ |
|
1091
|
|
|
return $this->isVariantMaster; |
|
1092
|
|
|
} |
|
1093
|
|
|
|
|
1094
|
|
|
/** |
|
1095
|
|
|
* @param bool|null $isVariantMaster |
|
1096
|
|
|
* |
|
1097
|
3 |
|
* @return ProductInterface |
|
1098
|
|
|
*/ |
|
1099
|
3 |
|
public function setIsVariantMaster($isVariantMaster) |
|
1100
|
3 |
|
{ |
|
1101
|
|
|
$this->isVariantMaster = $isVariantMaster; |
|
1102
|
|
|
|
|
1103
|
|
|
return $this; |
|
1104
|
|
|
} |
|
1105
|
|
|
|
|
1106
|
3 |
|
/** |
|
1107
|
|
|
* @return null|string |
|
1108
|
3 |
|
*/ |
|
1109
|
|
|
public function getLocationNumber() |
|
1110
|
|
|
{ |
|
1111
|
|
|
return $this->locationNumber; |
|
1112
|
|
|
} |
|
1113
|
|
|
|
|
1114
|
|
|
/** |
|
1115
|
3 |
|
* @param null|string $locationNumber |
|
1116
|
|
|
* |
|
1117
|
3 |
|
* @return ProductInterface |
|
1118
|
3 |
|
*/ |
|
1119
|
|
|
public function setLocationNumber($locationNumber) |
|
1120
|
|
|
{ |
|
1121
|
|
|
$this->locationNumber = $locationNumber; |
|
1122
|
|
|
|
|
1123
|
|
|
return $this; |
|
1124
|
3 |
|
} |
|
1125
|
|
|
|
|
1126
|
3 |
|
/** |
|
1127
|
|
|
* @return array|null |
|
1128
|
|
|
*/ |
|
1129
|
|
|
public function getManufacturereIdList() |
|
1130
|
|
|
{ |
|
1131
|
|
|
return $this->manufacturereIdList; |
|
1132
|
|
|
} |
|
1133
|
3 |
|
|
|
1134
|
|
|
/** |
|
1135
|
3 |
|
* @param array|null $manufacturereIdList |
|
1136
|
3 |
|
* |
|
1137
|
|
|
* @return ProductInterface |
|
1138
|
|
|
*/ |
|
1139
|
|
|
public function setManufacturereIdList($manufacturereIdList) |
|
1140
|
|
|
{ |
|
1141
|
|
|
$this->manufacturereIdList = $manufacturereIdList; |
|
1142
|
3 |
|
|
|
1143
|
|
|
return $this; |
|
1144
|
3 |
|
} |
|
1145
|
|
|
|
|
1146
|
|
|
/** |
|
1147
|
|
|
* @return int|null |
|
1148
|
|
|
*/ |
|
1149
|
|
|
public function getMaxBuyAmount() |
|
1150
|
|
|
{ |
|
1151
|
3 |
|
return $this->maxBuyAmount; |
|
1152
|
|
|
} |
|
1153
|
3 |
|
|
|
1154
|
3 |
|
/** |
|
1155
|
|
|
* @param int|null $maxBuyAmount |
|
1156
|
|
|
* |
|
1157
|
|
|
* @return ProductInterface |
|
1158
|
|
|
*/ |
|
1159
|
|
|
public function setMaxBuyAmount($maxBuyAmount) |
|
1160
|
3 |
|
{ |
|
1161
|
|
|
$this->maxBuyAmount = $maxBuyAmount; |
|
1162
|
3 |
|
|
|
1163
|
|
|
return $this; |
|
1164
|
|
|
} |
|
1165
|
|
|
|
|
1166
|
|
|
/** |
|
1167
|
|
|
* @return int|null |
|
1168
|
|
|
*/ |
|
1169
|
3 |
|
public function getMinBuyAmount() |
|
1170
|
|
|
{ |
|
1171
|
3 |
|
return $this->minBuyAmount; |
|
1172
|
3 |
|
} |
|
1173
|
|
|
|
|
1174
|
|
|
/** |
|
1175
|
|
|
* @param int|null $minBuyAmount |
|
1176
|
|
|
* |
|
1177
|
|
|
* @return ProductInterface |
|
1178
|
|
|
*/ |
|
1179
|
|
|
public function setMinBuyAmount($minBuyAmount) |
|
1180
|
|
|
{ |
|
1181
|
|
|
$this->minBuyAmount = $minBuyAmount; |
|
1182
|
|
|
|
|
1183
|
|
|
return $this; |
|
1184
|
|
|
} |
|
1185
|
|
|
|
|
1186
|
|
|
/** |
|
1187
|
|
|
* @return int|null |
|
1188
|
|
|
*/ |
|
1189
|
|
|
public function getMinBuyAmountB2B() |
|
1190
|
|
|
{ |
|
1191
|
|
|
return $this->minBuyAmountB2B; |
|
1192
|
|
|
} |
|
1193
|
|
|
|
|
1194
|
|
|
/** |
|
1195
|
|
|
* @param int|null $minBuyAmountB2B |
|
1196
|
|
|
* |
|
1197
|
|
|
* @return ProductInterface |
|
1198
|
|
|
*/ |
|
1199
|
|
|
public function setMinBuyAmountB2B($minBuyAmountB2B) |
|
1200
|
|
|
{ |
|
1201
|
|
|
$this->minBuyAmountB2B = $minBuyAmountB2B; |
|
1202
|
|
|
|
|
1203
|
|
|
return $this; |
|
1204
|
|
|
} |
|
1205
|
|
|
|
|
1206
|
|
|
/** |
|
1207
|
|
|
* @return string |
|
1208
|
|
|
*/ |
|
1209
|
|
|
public function getNumber() |
|
1210
|
|
|
{ |
|
1211
|
|
|
return (string) $this->number; |
|
1212
|
|
|
} |
|
1213
|
|
|
|
|
1214
|
3 |
|
/** |
|
1215
|
|
|
* @param string $number |
|
1216
|
3 |
|
* |
|
1217
|
|
|
* @return ProductInterface |
|
1218
|
|
|
*/ |
|
1219
|
|
|
public function setNumber(string $number) |
|
1220
|
|
|
{ |
|
1221
|
|
|
$this->number = $number; |
|
1222
|
|
|
|
|
1223
|
3 |
|
return $this; |
|
1224
|
|
|
} |
|
1225
|
3 |
|
|
|
1226
|
3 |
|
/** |
|
1227
|
|
|
* @return null|string |
|
1228
|
|
|
*/ |
|
1229
|
|
|
public function getPicture() |
|
1230
|
|
|
{ |
|
1231
|
|
|
return $this->picture; |
|
1232
|
3 |
|
} |
|
1233
|
|
|
|
|
1234
|
3 |
|
/** |
|
1235
|
|
|
* @param null|string $picture |
|
1236
|
|
|
* |
|
1237
|
|
|
* @return ProductInterface |
|
1238
|
|
|
*/ |
|
1239
|
|
|
public function setPicture($picture) |
|
1240
|
|
|
{ |
|
1241
|
3 |
|
$this->picture = $picture; |
|
1242
|
|
|
|
|
1243
|
3 |
|
return $this; |
|
1244
|
3 |
|
} |
|
1245
|
|
|
|
|
1246
|
|
|
/** |
|
1247
|
|
|
* @return int|null |
|
1248
|
|
|
*/ |
|
1249
|
|
|
public function getSalesCount() |
|
1250
|
3 |
|
{ |
|
1251
|
|
|
return $this->salesCount; |
|
1252
|
3 |
|
} |
|
1253
|
|
|
|
|
1254
|
|
|
/** |
|
1255
|
|
|
* @param int|null $salesCount |
|
1256
|
|
|
* |
|
1257
|
|
|
* @return ProductInterface |
|
1258
|
|
|
*/ |
|
1259
|
3 |
|
public function setSalesCount($salesCount) |
|
1260
|
|
|
{ |
|
1261
|
3 |
|
$this->salesCount = $salesCount; |
|
1262
|
3 |
|
|
|
1263
|
|
|
return $this; |
|
1264
|
|
|
} |
|
1265
|
|
|
|
|
1266
|
|
|
/** |
|
1267
|
|
|
* @return array|null |
|
1268
|
|
|
*/ |
|
1269
|
|
|
public function getSegmentIdList() |
|
1270
|
|
|
{ |
|
1271
|
|
|
return $this->segmentIdList; |
|
1272
|
|
|
} |
|
1273
|
|
|
|
|
1274
|
|
|
/** |
|
1275
|
|
|
* @param array|null $segmentIdList |
|
1276
|
|
|
* |
|
1277
|
|
|
* @return ProductInterface |
|
1278
|
|
|
*/ |
|
1279
|
|
|
public function setSegmentIdList($segmentIdList) |
|
1280
|
|
|
{ |
|
1281
|
|
|
$this->segmentIdList = $segmentIdList; |
|
1282
|
|
|
|
|
1283
|
|
|
return $this; |
|
1284
|
|
|
} |
|
1285
|
|
|
|
|
1286
|
|
|
/** |
|
1287
|
|
|
* @return int|null |
|
1288
|
|
|
*/ |
|
1289
|
|
|
public function getSortOrder() |
|
1290
|
|
|
{ |
|
1291
|
|
|
return $this->sortOrder; |
|
1292
|
|
|
} |
|
1293
|
|
|
|
|
1294
|
|
|
/** |
|
1295
|
|
|
* @param int|null $sortOrder |
|
1296
|
|
|
* |
|
1297
|
|
|
* @return ProductInterface |
|
1298
|
|
|
*/ |
|
1299
|
|
|
public function setSortOrder($sortOrder) |
|
1300
|
|
|
{ |
|
1301
|
|
|
$this->sortOrder = $sortOrder; |
|
1302
|
|
|
|
|
1303
|
|
|
return $this; |
|
1304
|
|
|
} |
|
1305
|
|
|
|
|
1306
|
|
|
/** |
|
1307
|
|
|
* @return int|null |
|
1308
|
|
|
*/ |
|
1309
|
|
|
public function getStockCount() |
|
1310
|
|
|
{ |
|
1311
|
|
|
return $this->stockCount; |
|
1312
|
|
|
} |
|
1313
|
|
|
|
|
1314
|
|
|
/** |
|
1315
|
|
|
* @param int|null $stockCount |
|
1316
|
|
|
* |
|
1317
|
|
|
* @return ProductInterface |
|
1318
|
|
|
*/ |
|
1319
|
|
|
public function setStockCount($stockCount) |
|
1320
|
|
|
{ |
|
1321
|
|
|
$this->stockCount = $stockCount; |
|
1322
|
|
|
|
|
1323
|
|
|
return $this; |
|
1324
|
|
|
} |
|
1325
|
|
|
|
|
1326
|
|
|
/** |
|
1327
|
|
|
* @return int|null |
|
1328
|
|
|
*/ |
|
1329
|
|
|
public function getStockLimit() |
|
1330
|
|
|
{ |
|
1331
|
|
|
return $this->stockLimit; |
|
1332
|
|
|
} |
|
1333
|
|
|
|
|
1334
|
|
|
/** |
|
1335
|
|
|
* @param int|null $stockLimit |
|
1336
|
|
|
* |
|
1337
|
|
|
* @return ProductInterface |
|
1338
|
|
|
*/ |
|
1339
|
|
|
public function setStockLimit($stockLimit) |
|
1340
|
|
|
{ |
|
1341
|
|
|
$this->stockLimit = $stockLimit; |
|
1342
|
|
|
|
|
1343
|
|
|
return $this; |
|
1344
|
|
|
} |
|
1345
|
|
|
|
|
1346
|
|
|
/** |
|
1347
|
|
|
* @return int|null |
|
1348
|
|
|
*/ |
|
1349
|
|
|
public function getTypeId() |
|
1350
|
|
|
{ |
|
1351
|
|
|
return $this->typeId; |
|
1352
|
|
|
} |
|
1353
|
|
|
|
|
1354
|
|
|
/** |
|
1355
|
|
|
* @param int|null $typeId |
|
1356
|
|
|
* |
|
1357
|
|
|
* @return ProductInterface |
|
1358
|
|
|
*/ |
|
1359
|
|
|
public function setTypeId($typeId) |
|
1360
|
|
|
{ |
|
1361
|
|
|
$this->typeId = $typeId; |
|
1362
|
|
|
|
|
1363
|
|
|
return $this; |
|
1364
|
|
|
} |
|
1365
|
|
|
|
|
1366
|
|
|
/** |
|
1367
|
|
|
* @return \DateTimeImmutable|null |
|
1368
|
|
|
*/ |
|
1369
|
|
|
public function getUpdated() |
|
1370
|
|
|
{ |
|
1371
|
|
|
return $this->updated; |
|
1372
|
|
|
} |
|
1373
|
|
|
|
|
1374
|
|
|
/** |
|
1375
|
|
|
* @param \DateTimeImmutable|null $updated |
|
1376
|
|
|
* |
|
1377
|
|
|
* @return ProductInterface |
|
1378
|
|
|
*/ |
|
1379
|
|
|
public function setUpdated($updated) |
|
1380
|
|
|
{ |
|
1381
|
|
|
$this->updated = $updated; |
|
1382
|
|
|
|
|
1383
|
|
|
return $this; |
|
1384
|
|
|
} |
|
1385
|
|
|
|
|
1386
|
|
|
/** |
|
1387
|
|
|
* @return null|string |
|
1388
|
|
|
*/ |
|
1389
|
|
|
public function getUpdatedBy() |
|
1390
|
|
|
{ |
|
1391
|
|
|
return $this->updatedBy; |
|
1392
|
|
|
} |
|
1393
|
|
|
|
|
1394
|
|
|
/** |
|
1395
|
|
|
* @param null|string $updatedBy |
|
1396
|
|
|
* |
|
1397
|
|
|
* @return ProductInterface |
|
1398
|
|
|
*/ |
|
1399
|
|
|
public function setUpdatedBy($updatedBy) |
|
1400
|
|
|
{ |
|
1401
|
|
|
$this->updatedBy = $updatedBy; |
|
1402
|
|
|
|
|
1403
|
|
|
return $this; |
|
1404
|
|
|
} |
|
1405
|
|
|
|
|
1406
|
|
|
/** |
|
1407
|
|
|
* @return array|null |
|
1408
|
|
|
*/ |
|
1409
|
|
|
public function getVariantGroupIdList() |
|
1410
|
|
|
{ |
|
1411
|
|
|
return $this->variantGroupIdList; |
|
1412
|
|
|
} |
|
1413
|
|
|
|
|
1414
|
|
|
/** |
|
1415
|
|
|
* @param array|null $variantGroupIdList |
|
1416
|
|
|
* |
|
1417
|
|
|
* @return ProductInterface |
|
1418
|
|
|
*/ |
|
1419
|
|
|
public function setVariantGroupIdList($variantGroupIdList) |
|
1420
|
|
|
{ |
|
1421
|
|
|
$this->variantGroupIdList = $variantGroupIdList; |
|
1422
|
|
|
|
|
1423
|
|
|
return $this; |
|
1424
|
|
|
} |
|
1425
|
|
|
|
|
1426
|
|
|
/** |
|
1427
|
|
|
* @return array|null |
|
1428
|
|
|
*/ |
|
1429
|
|
|
public function getVariantIdList() |
|
1430
|
|
|
{ |
|
1431
|
|
|
return $this->variantIdList; |
|
1432
|
|
|
} |
|
1433
|
|
|
|
|
1434
|
|
|
/** |
|
1435
|
|
|
* @param array|null $variantIdList |
|
1436
|
|
|
* |
|
1437
|
|
|
* @return ProductInterface |
|
1438
|
|
|
*/ |
|
1439
|
|
|
public function setVariantIdList($variantIdList) |
|
1440
|
|
|
{ |
|
1441
|
|
|
$this->variantIdList = $variantIdList; |
|
1442
|
|
|
|
|
1443
|
|
|
return $this; |
|
1444
|
|
|
} |
|
1445
|
|
|
|
|
1446
|
|
|
/** |
|
1447
|
|
|
* @return int|null |
|
1448
|
|
|
*/ |
|
1449
|
|
|
public function getVariantMasterId() |
|
1450
|
|
|
{ |
|
1451
|
|
|
return $this->variantMasterId; |
|
1452
|
|
|
} |
|
1453
|
|
|
|
|
1454
|
|
|
/** |
|
1455
|
|
|
* @param int|null $variantMasterId |
|
1456
|
|
|
* |
|
1457
|
|
|
* @return ProductInterface |
|
1458
|
|
|
*/ |
|
1459
|
|
|
public function setVariantMasterId($variantMasterId) |
|
1460
|
|
|
{ |
|
1461
|
|
|
$this->variantMasterId = $variantMasterId; |
|
1462
|
|
|
|
|
1463
|
|
|
return $this; |
|
1464
|
|
|
} |
|
1465
|
|
|
|
|
1466
|
|
|
/** |
|
1467
|
|
|
* @return null|string |
|
1468
|
|
|
*/ |
|
1469
|
|
|
public function getVendorNumber() |
|
1470
|
|
|
{ |
|
1471
|
|
|
return $this->vendorNumber; |
|
1472
|
|
|
} |
|
1473
|
|
|
|
|
1474
|
|
|
/** |
|
1475
|
|
|
* @param null|string $vendorNumber |
|
1476
|
|
|
* |
|
1477
|
|
|
* @return ProductInterface |
|
1478
|
|
|
*/ |
|
1479
|
|
|
public function setVendorNumber($vendorNumber) |
|
1480
|
|
|
{ |
|
1481
|
|
|
$this->vendorNumber = $vendorNumber; |
|
1482
|
|
|
|
|
1483
|
|
|
return $this; |
|
1484
|
|
|
} |
|
1485
|
|
|
|
|
1486
|
|
|
/** |
|
1487
|
|
|
* @return int|null |
|
1488
|
|
|
*/ |
|
1489
|
|
|
public function getWeight() |
|
1490
|
|
|
{ |
|
1491
|
|
|
return $this->weight; |
|
1492
|
|
|
} |
|
1493
|
|
|
|
|
1494
|
|
|
/** |
|
1495
|
|
|
* @param int|null $weight |
|
1496
|
|
|
* |
|
1497
|
|
|
* @return ProductInterface |
|
1498
|
|
|
*/ |
|
1499
|
|
|
public function setWeight($weight) |
|
1500
|
|
|
{ |
|
1501
|
|
|
$this->weight = $weight; |
|
1502
|
|
|
|
|
1503
|
|
|
return $this; |
|
1504
|
|
|
} |
|
1505
|
|
|
|
|
1506
|
|
|
/** |
|
1507
|
|
|
* @return ArrayCollection|Category[] |
|
1508
|
|
|
*/ |
|
1509
|
|
|
public function getCategories() |
|
1510
|
|
|
{ |
|
1511
|
|
|
return $this->categories; |
|
1512
|
|
|
} |
|
1513
|
|
|
|
|
1514
|
|
|
/** |
|
1515
|
|
|
* @param ArrayCollection|Category[] $categories |
|
1516
|
|
|
* |
|
1517
|
|
|
* @return ProductInterface |
|
1518
|
|
|
*/ |
|
1519
|
|
|
public function setCategories($categories) |
|
1520
|
|
|
{ |
|
1521
|
|
|
$this->categories = $categories; |
|
1522
|
|
|
|
|
1523
|
|
|
return $this; |
|
1524
|
|
|
} |
|
1525
|
|
|
|
|
1526
|
|
|
/** |
|
1527
|
|
|
* @return ArrayCollection|Variant[] |
|
1528
|
|
|
*/ |
|
1529
|
|
|
public function getDisabledVariants() |
|
1530
|
|
|
{ |
|
1531
|
|
|
return $this->disabledVariants; |
|
1532
|
|
|
} |
|
1533
|
|
|
|
|
1534
|
|
|
/** |
|
1535
|
|
|
* @param ArrayCollection|Variant[] $disabledVariants |
|
1536
|
|
|
* |
|
1537
|
|
|
* @return ProductInterface |
|
1538
|
|
|
*/ |
|
1539
|
|
|
public function setDisabledVariants($disabledVariants) |
|
1540
|
|
|
{ |
|
1541
|
|
|
$this->disabledVariants = $disabledVariants; |
|
1542
|
|
|
|
|
1543
|
|
|
return $this; |
|
1544
|
|
|
} |
|
1545
|
|
|
|
|
1546
|
|
|
/** |
|
1547
|
|
|
* @return ArrayCollection|Manufacturer[] |
|
1548
|
|
|
*/ |
|
1549
|
|
|
public function getManufacturers() |
|
1550
|
|
|
{ |
|
1551
|
|
|
return $this->manufacturers; |
|
1552
|
|
|
} |
|
1553
|
|
|
|
|
1554
|
|
|
/** |
|
1555
|
|
|
* @param ArrayCollection|Manufacturer[] $manufacturers |
|
1556
|
|
|
* |
|
1557
|
|
|
* @return ProductInterface |
|
1558
|
|
|
*/ |
|
1559
|
|
|
public function setManufacturers($manufacturers) |
|
1560
|
|
|
{ |
|
1561
|
|
|
$this->manufacturers = $manufacturers; |
|
1562
|
|
|
|
|
1563
|
|
|
return $this; |
|
1564
|
|
|
} |
|
1565
|
|
|
|
|
1566
|
|
|
/** |
|
1567
|
|
|
* @return ArrayCollection|Medium[] |
|
1568
|
|
|
*/ |
|
1569
|
|
|
public function getMedia() |
|
1570
|
|
|
{ |
|
1571
|
|
|
return $this->media; |
|
1572
|
|
|
} |
|
1573
|
|
|
|
|
1574
|
|
|
/** |
|
1575
|
|
|
* @param ArrayCollection|Medium[] $media |
|
1576
|
|
|
* |
|
1577
|
|
|
* @return ProductInterface |
|
1578
|
|
|
*/ |
|
1579
|
|
|
public function setMedia($media) |
|
1580
|
|
|
{ |
|
1581
|
|
|
$this->media = $media; |
|
1582
|
|
|
|
|
1583
|
|
|
return $this; |
|
1584
|
|
|
} |
|
1585
|
|
|
|
|
1586
|
|
|
/** |
|
1587
|
|
|
* @return ArrayCollection|Price[] |
|
1588
|
|
|
*/ |
|
1589
|
|
|
public function getPrices() |
|
1590
|
|
|
{ |
|
1591
|
|
|
return $this->prices; |
|
1592
|
|
|
} |
|
1593
|
|
|
|
|
1594
|
|
|
/** |
|
1595
|
|
|
* @param ArrayCollection|Price[] $prices |
|
1596
|
|
|
* |
|
1597
|
|
|
* @return ProductInterface |
|
1598
|
|
|
*/ |
|
1599
|
|
|
public function setPrices($prices) |
|
1600
|
|
|
{ |
|
1601
|
|
|
$this->prices = $prices; |
|
1602
|
|
|
|
|
1603
|
|
|
return $this; |
|
1604
|
|
|
} |
|
1605
|
|
|
|
|
1606
|
|
|
/** |
|
1607
|
|
|
* @return ArrayCollection|ProductRelation[] |
|
1608
|
|
|
*/ |
|
1609
|
|
|
public function getProductRelations() |
|
1610
|
|
|
{ |
|
1611
|
|
|
return $this->productRelations; |
|
1612
|
|
|
} |
|
1613
|
|
|
|
|
1614
|
|
|
/** |
|
1615
|
|
|
* @param ArrayCollection|ProductRelation[] $productRelations |
|
1616
|
|
|
* |
|
1617
|
|
|
* @return ProductInterface |
|
1618
|
|
|
*/ |
|
1619
|
|
|
public function setProductRelations($productRelations) |
|
1620
|
|
|
{ |
|
1621
|
|
|
$this->productRelations = $productRelations; |
|
1622
|
|
|
|
|
1623
|
|
|
return $this; |
|
1624
|
|
|
} |
|
1625
|
|
|
|
|
1626
|
|
|
/** |
|
1627
|
|
|
* @return ProductTypeInterface |
|
1628
|
|
|
*/ |
|
1629
|
|
|
public function getProductType(): ProductTypeInterface |
|
1630
|
|
|
{ |
|
1631
|
|
|
return $this->productType; |
|
1632
|
|
|
} |
|
1633
|
|
|
|
|
1634
|
|
|
/** |
|
1635
|
|
|
* @param ProductType $productType |
|
1636
|
|
|
* |
|
1637
|
|
|
* @return ProductInterface |
|
1638
|
|
|
*/ |
|
1639
|
|
|
public function setProductType(ProductType $productType) |
|
1640
|
|
|
{ |
|
1641
|
|
|
$this->productType = $productType; |
|
1642
|
|
|
|
|
1643
|
|
|
return $this; |
|
1644
|
|
|
} |
|
1645
|
|
|
|
|
1646
|
|
|
/** |
|
1647
|
|
|
* @return ArrayCollection|Segment[] |
|
1648
|
|
|
*/ |
|
1649
|
|
|
public function getSegments() |
|
1650
|
|
|
{ |
|
1651
|
|
|
return $this->segments; |
|
1652
|
|
|
} |
|
1653
|
|
|
|
|
1654
|
|
|
/** |
|
1655
|
|
|
* @param ArrayCollection|Segment[] $segments |
|
1656
|
|
|
* |
|
1657
|
|
|
* @return ProductInterface |
|
1658
|
|
|
*/ |
|
1659
|
|
|
public function setSegments($segments) |
|
1660
|
|
|
{ |
|
1661
|
|
|
$this->segments = $segments; |
|
1662
|
|
|
|
|
1663
|
|
|
return $this; |
|
1664
|
|
|
} |
|
1665
|
|
|
|
|
1666
|
|
|
/** |
|
1667
|
|
|
* @return ArrayCollection|VariantGroup[] |
|
1668
|
|
|
*/ |
|
1669
|
|
|
public function getVariantGroups() |
|
1670
|
|
|
{ |
|
1671
|
|
|
return $this->variantGroups; |
|
1672
|
|
|
} |
|
1673
|
|
|
|
|
1674
|
|
|
/** |
|
1675
|
|
|
* @param ArrayCollection|VariantGroup[] $variantGroups |
|
1676
|
|
|
* |
|
1677
|
|
|
* @return ProductInterface |
|
1678
|
|
|
*/ |
|
1679
|
|
|
public function setVariantGroups($variantGroups) |
|
1680
|
|
|
{ |
|
1681
|
|
|
$this->variantGroups = $variantGroups; |
|
1682
|
|
|
|
|
1683
|
|
|
return $this; |
|
1684
|
|
|
} |
|
1685
|
|
|
|
|
1686
|
|
|
/** |
|
1687
|
|
|
* @return ArrayCollection|Variant[] |
|
1688
|
|
|
*/ |
|
1689
|
|
|
public function getVariants() |
|
1690
|
|
|
{ |
|
1691
|
|
|
return $this->variants; |
|
1692
|
|
|
} |
|
1693
|
|
|
|
|
1694
|
|
|
/** |
|
1695
|
|
|
* @param ArrayCollection|Variant[] $variants |
|
1696
|
|
|
* |
|
1697
|
|
|
* @return ProductInterface |
|
1698
|
|
|
*/ |
|
1699
|
|
|
public function setVariants($variants) |
|
1700
|
|
|
{ |
|
1701
|
|
|
$this->variants = $variants; |
|
1702
|
|
|
|
|
1703
|
|
|
return $this; |
|
1704
|
|
|
} |
|
1705
|
|
|
|
|
1706
|
|
|
/** |
|
1707
|
|
|
* @return ProductInterface|null |
|
1708
|
|
|
*/ |
|
1709
|
|
|
public function getParent(): ?ProductInterface |
|
1710
|
|
|
{ |
|
1711
|
|
|
return $this->parent; |
|
1712
|
|
|
} |
|
1713
|
|
|
|
|
1714
|
|
|
/** |
|
1715
|
|
|
* @param ProductInterface|null $parent |
|
1716
|
|
|
* |
|
1717
|
|
|
* @return Product |
|
1718
|
|
|
*/ |
|
1719
|
|
|
public function setParent(?ProductInterface $parent) |
|
1720
|
|
|
{ |
|
1721
|
|
|
$this->parent = $parent; |
|
1722
|
|
|
|
|
1723
|
|
|
return $this; |
|
1724
|
|
|
} |
|
1725
|
|
|
|
|
1726
|
|
|
/** |
|
1727
|
|
|
* @return ArrayCollection|Product[] |
|
1728
|
|
|
*/ |
|
1729
|
|
|
public function getChildren() |
|
1730
|
|
|
{ |
|
1731
|
|
|
return $this->children; |
|
1732
|
|
|
} |
|
1733
|
|
|
|
|
1734
|
|
|
/** |
|
1735
|
|
|
* @param ArrayCollection|Product[] $children |
|
1736
|
|
|
* |
|
1737
|
|
|
* @return Product |
|
1738
|
|
|
*/ |
|
1739
|
|
|
public function setChildren($children) |
|
1740
|
|
|
{ |
|
1741
|
|
|
$this->children = $children; |
|
1742
|
|
|
|
|
1743
|
|
|
return $this; |
|
1744
|
|
|
} |
|
1745
|
|
|
|
|
1746
|
|
|
/** |
|
1747
|
|
|
* This method will try to find a price based on the unique constraint defined in price. |
|
1748
|
|
|
* |
|
1749
|
|
|
* @param PriceInterface $searchPrice |
|
1750
|
|
|
* |
|
1751
|
|
|
* @return PriceInterface|null |
|
1752
|
|
|
*/ |
|
1753
|
|
|
protected function findPrice(PriceInterface $searchPrice): ?PriceInterface |
|
1754
|
|
|
{ |
|
1755
|
|
|
foreach ($this->prices as $price) { |
|
1756
|
|
|
if ($price->getAmount() == $searchPrice->getAmount() && $price->getB2bGroupId() == $searchPrice->getB2bGroupId() && $price->getCurrency()->getId() == $searchPrice->getCurrency()->getId()) { |
|
1757
|
|
|
return $price; |
|
1758
|
|
|
} |
|
1759
|
|
|
} |
|
1760
|
|
|
|
|
1761
|
|
|
return null; |
|
1762
|
|
|
} |
|
1763
|
|
|
} |
|
1764
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths