These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of EC-CUBE |
||
5 | * |
||
6 | * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. |
||
7 | * |
||
8 | * http://www.ec-cube.co.jp/ |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace Eccube\Entity; |
||
15 | |||
16 | use Doctrine\Common\Collections\ArrayCollection; |
||
17 | use Doctrine\ORM\Mapping as ORM; |
||
18 | |||
19 | 1 | if (!class_exists('\Eccube\Entity\Product')) { |
|
20 | /** |
||
21 | * Product |
||
22 | * |
||
23 | * @ORM\Table(name="dtb_product") |
||
24 | * @ORM\InheritanceType("SINGLE_TABLE") |
||
25 | * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255) |
||
26 | * @ORM\HasLifecycleCallbacks() |
||
27 | * @ORM\Entity(repositoryClass="Eccube\Repository\ProductRepository") |
||
28 | */ |
||
29 | class Product extends \Eccube\Entity\AbstractEntity |
||
30 | { |
||
31 | private $_calc = false; |
||
32 | private $stockFinds = []; |
||
33 | private $stocks = []; |
||
34 | private $stockUnlimiteds = []; |
||
35 | private $price01 = []; |
||
36 | private $price02 = []; |
||
37 | private $price01IncTaxs = []; |
||
38 | private $price02IncTaxs = []; |
||
39 | private $codes = []; |
||
40 | private $classCategories1 = []; |
||
41 | private $classCategories2 = []; |
||
42 | private $className1; |
||
43 | private $className2; |
||
44 | |||
45 | /** |
||
46 | * @return string |
||
47 | */ |
||
48 | public function __toString() |
||
49 | { |
||
50 | return (string) $this->getName(); |
||
51 | } |
||
52 | |||
53 | 49 | public function _calc() |
|
54 | { |
||
55 | 49 | if (!$this->_calc) { |
|
56 | 49 | $i = 0; |
|
57 | 49 | foreach ($this->getProductClasses() as $ProductClass) { |
|
58 | /* @var $ProductClass \Eccube\Entity\ProductClass */ |
||
59 | // stock_find |
||
60 | 49 | if ($ProductClass->isVisible() == false) { |
|
61 | 49 | continue; |
|
62 | } |
||
63 | 49 | $ClassCategory1 = $ProductClass->getClassCategory1(); |
|
64 | 49 | $ClassCategory2 = $ProductClass->getClassCategory2(); |
|
65 | 49 | if ($ClassCategory1 && !$ClassCategory1->isVisible()) { |
|
66 | continue; |
||
67 | } |
||
68 | 49 | if ($ClassCategory2 && !$ClassCategory2->isVisible()) { |
|
69 | continue; |
||
70 | } |
||
71 | |||
72 | // stock_find |
||
73 | 49 | $this->stockFinds[] = $ProductClass->getStockFind(); |
|
74 | |||
75 | // stock |
||
76 | 49 | $this->stocks[] = $ProductClass->getStock(); |
|
77 | |||
78 | // stock_unlimited |
||
79 | 49 | $this->stockUnlimiteds[] = $ProductClass->isStockUnlimited(); |
|
80 | |||
81 | // price01 |
||
82 | 49 | if (!is_null($ProductClass->getPrice01())) { |
|
83 | 7 | $this->price01[] = $ProductClass->getPrice01(); |
|
84 | // price01IncTax |
||
85 | 7 | $this->price01IncTaxs[] = $ProductClass->getPrice01IncTax(); |
|
86 | } |
||
87 | |||
88 | // price02 |
||
89 | 49 | $this->price02[] = $ProductClass->getPrice02(); |
|
90 | |||
91 | // price02IncTax |
||
92 | 49 | $this->price02IncTaxs[] = $ProductClass->getPrice02IncTax(); |
|
93 | |||
94 | // product_code |
||
95 | 49 | $this->codes[] = $ProductClass->getCode(); |
|
96 | |||
97 | 49 | if ($i === 0) { |
|
98 | 49 | if ($ProductClass->getClassCategory1() && $ProductClass->getClassCategory1()->getId()) { |
|
99 | 49 | $this->className1 = $ProductClass->getClassCategory1()->getClassName()->getName(); |
|
100 | } |
||
101 | 49 | if ($ProductClass->getClassCategory2() && $ProductClass->getClassCategory2()->getId()) { |
|
102 | 33 | $this->className2 = $ProductClass->getClassCategory2()->getClassName()->getName(); |
|
103 | } |
||
104 | } |
||
105 | 49 | if ($ProductClass->getClassCategory1()) { |
|
106 | 49 | $classCategoryId1 = $ProductClass->getClassCategory1()->getId(); |
|
107 | 49 | if (!empty($classCategoryId1)) { |
|
108 | 49 | if ($ProductClass->getClassCategory2()) { |
|
109 | 49 | $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName(); |
|
110 | 33 | $this->classCategories2[$ProductClass->getClassCategory1()->getId()][$ProductClass->getClassCategory2()->getId()] = $ProductClass->getClassCategory2()->getName(); |
|
111 | } else { |
||
112 | $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName().($ProductClass->getStockFind() ? '' : trans('front.product.out_of_stock_label')); |
||
113 | } |
||
114 | 49 | } |
|
115 | } |
||
116 | 49 | $i++; |
|
117 | } |
||
118 | $this->_calc = true; |
||
119 | } |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * Is Enable |
||
124 | * |
||
125 | 80 | * @return bool |
|
126 | * |
||
127 | 80 | * @deprecated |
|
128 | */ |
||
129 | public function isEnable() |
||
130 | { |
||
131 | return $this->getStatus()->getId() === \Eccube\Entity\Master\ProductStatus::DISPLAY_SHOW ? true : false; |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | 45 | * Get ClassName1 |
|
136 | * |
||
137 | 45 | * @return string |
|
138 | */ |
||
139 | 45 | public function getClassName1() |
|
140 | { |
||
141 | $this->_calc(); |
||
142 | |||
143 | return $this->className1; |
||
144 | } |
||
145 | |||
146 | /** |
||
147 | 45 | * Get ClassName2 |
|
148 | * |
||
149 | 45 | * @return string |
|
150 | */ |
||
151 | 45 | public function getClassName2() |
|
152 | { |
||
153 | $this->_calc(); |
||
154 | |||
155 | return $this->className2; |
||
156 | } |
||
157 | |||
158 | /** |
||
159 | 46 | * Get getClassCategories1 |
|
160 | * |
||
161 | 46 | * @return array |
|
162 | */ |
||
163 | 46 | public function getClassCategories1() |
|
164 | { |
||
165 | $this->_calc(); |
||
166 | 45 | ||
167 | return $this->classCategories1; |
||
168 | 45 | } |
|
169 | |||
170 | public function getClassCategories1AsFlip() |
||
171 | { |
||
172 | return array_flip($this->getClassCategories1()); |
||
173 | } |
||
174 | |||
175 | /** |
||
176 | 4 | * Get getClassCategories2 |
|
177 | * |
||
178 | 4 | * @return array |
|
179 | */ |
||
180 | 4 | public function getClassCategories2($class_category1) |
|
181 | { |
||
182 | $this->_calc(); |
||
183 | 3 | ||
184 | return isset($this->classCategories2[$class_category1]) ? $this->classCategories2[$class_category1] : []; |
||
185 | 3 | } |
|
186 | |||
187 | public function getClassCategories2AsFlip($class_category1) |
||
188 | { |
||
189 | return array_flip($this->getClassCategories2($class_category1)); |
||
190 | } |
||
191 | |||
192 | /** |
||
193 | 46 | * Get StockFind |
|
194 | * |
||
195 | 46 | * @return bool |
|
196 | */ |
||
197 | 46 | public function getStockFind() |
|
198 | { |
||
199 | $this->_calc(); |
||
200 | |||
201 | return max($this->stockFinds); |
||
202 | } |
||
203 | |||
204 | /** |
||
205 | * Get Stock min |
||
206 | * |
||
207 | * @return integer |
||
208 | */ |
||
209 | public function getStockMin() |
||
210 | { |
||
211 | $this->_calc(); |
||
212 | |||
213 | return min($this->stocks); |
||
214 | } |
||
215 | |||
216 | /** |
||
217 | * Get Stock max |
||
218 | * |
||
219 | * @return integer |
||
220 | */ |
||
221 | public function getStockMax() |
||
222 | { |
||
223 | $this->_calc(); |
||
224 | |||
225 | return max($this->stocks); |
||
226 | } |
||
227 | |||
228 | /** |
||
229 | * Get StockUnlimited min |
||
230 | * |
||
231 | * @return integer |
||
232 | */ |
||
233 | public function getStockUnlimitedMin() |
||
234 | { |
||
235 | $this->_calc(); |
||
236 | |||
237 | return min($this->stockUnlimiteds); |
||
238 | } |
||
239 | |||
240 | /** |
||
241 | * Get StockUnlimited max |
||
242 | * |
||
243 | * @return integer |
||
244 | */ |
||
245 | public function getStockUnlimitedMax() |
||
246 | { |
||
247 | $this->_calc(); |
||
248 | |||
249 | return max($this->stockUnlimiteds); |
||
250 | } |
||
251 | |||
252 | /** |
||
253 | 11 | * Get Price01 min |
|
254 | * |
||
255 | 11 | * @return integer |
|
256 | */ |
||
257 | 11 | View Code Duplication | public function getPrice01Min() |
0 ignored issues
–
show
|
|||
258 | 9 | { |
|
259 | $this->_calc(); |
||
260 | |||
261 | 2 | if (count($this->price01) == 0) { |
|
262 | return null; |
||
263 | } |
||
264 | |||
265 | return min($this->price01); |
||
266 | } |
||
267 | |||
268 | /** |
||
269 | 2 | * Get Price01 max |
|
270 | * |
||
271 | 2 | * @return integer |
|
272 | */ |
||
273 | 2 | View Code Duplication | public function getPrice01Max() |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
274 | { |
||
275 | $this->_calc(); |
||
276 | |||
277 | 2 | if (count($this->price01) == 0) { |
|
278 | return null; |
||
279 | } |
||
280 | |||
281 | return max($this->price01); |
||
282 | } |
||
283 | |||
284 | /** |
||
285 | 3 | * Get Price02 min |
|
286 | * |
||
287 | 3 | * @return integer |
|
288 | */ |
||
289 | 3 | public function getPrice02Min() |
|
290 | { |
||
291 | $this->_calc(); |
||
292 | |||
293 | return min($this->price02); |
||
294 | } |
||
295 | |||
296 | /** |
||
297 | 3 | * Get Price02 max |
|
298 | * |
||
299 | 3 | * @return integer |
|
300 | */ |
||
301 | 3 | public function getPrice02Max() |
|
302 | { |
||
303 | $this->_calc(); |
||
304 | |||
305 | return max($this->price02); |
||
306 | } |
||
307 | |||
308 | /** |
||
309 | 2 | * Get Price01IncTax min |
|
310 | * |
||
311 | 2 | * @return integer |
|
312 | */ |
||
313 | 2 | public function getPrice01IncTaxMin() |
|
314 | { |
||
315 | $this->_calc(); |
||
316 | |||
317 | return min($this->price01IncTaxs); |
||
318 | } |
||
319 | |||
320 | /** |
||
321 | 2 | * Get Price01IncTax max |
|
322 | * |
||
323 | 2 | * @return integer |
|
324 | */ |
||
325 | 2 | public function getPrice01IncTaxMax() |
|
326 | { |
||
327 | $this->_calc(); |
||
328 | |||
329 | return max($this->price01IncTaxs); |
||
330 | } |
||
331 | |||
332 | /** |
||
333 | 14 | * Get Price02IncTax min |
|
334 | * |
||
335 | 14 | * @return integer |
|
336 | */ |
||
337 | 14 | public function getPrice02IncTaxMin() |
|
338 | { |
||
339 | $this->_calc(); |
||
340 | |||
341 | return min($this->price02IncTaxs); |
||
342 | } |
||
343 | |||
344 | /** |
||
345 | 14 | * Get Price02IncTax max |
|
346 | * |
||
347 | 14 | * @return integer |
|
348 | */ |
||
349 | 14 | public function getPrice02IncTaxMax() |
|
350 | { |
||
351 | $this->_calc(); |
||
352 | |||
353 | return max($this->price02IncTaxs); |
||
354 | } |
||
355 | |||
356 | /** |
||
357 | 13 | * Get Product_code min |
|
358 | * |
||
359 | 13 | * @return integer |
|
360 | */ |
||
361 | 13 | View Code Duplication | public function getCodeMin() |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
362 | 13 | { |
|
363 | 13 | $this->_calc(); |
|
364 | 13 | ||
365 | $codes = []; |
||
366 | foreach ($this->codes as $code) { |
||
367 | if (!is_null($code)) { |
||
368 | 13 | $codes[] = $code; |
|
369 | } |
||
370 | } |
||
371 | |||
372 | return count($codes) ? min($codes) : null; |
||
373 | } |
||
374 | |||
375 | /** |
||
376 | 13 | * Get Product_code max |
|
377 | * |
||
378 | 13 | * @return integer |
|
379 | */ |
||
380 | 13 | View Code Duplication | public function getCodeMax() |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
381 | 13 | { |
|
382 | 13 | $this->_calc(); |
|
383 | 13 | ||
384 | $codes = []; |
||
385 | foreach ($this->codes as $code) { |
||
386 | if (!is_null($code)) { |
||
387 | 13 | $codes[] = $code; |
|
388 | } |
||
389 | } |
||
390 | 62 | ||
391 | return count($codes) ? max($codes) : null; |
||
392 | 62 | } |
|
393 | |||
394 | 62 | public function getMainListImage() |
|
395 | { |
||
396 | $ProductImages = $this->getProductImage(); |
||
397 | 1 | ||
398 | return empty($ProductImages) ? null : $ProductImages[0]; |
||
399 | 1 | } |
|
400 | 1 | ||
401 | public function getMainFileName() |
||
402 | { |
||
403 | if (count($this->ProductImage) > 0) { |
||
404 | return $this->ProductImage[0]; |
||
405 | } else { |
||
406 | 43 | return null; |
|
407 | } |
||
408 | 43 | } |
|
409 | 43 | ||
410 | 1 | public function hasProductClass() |
|
411 | { |
||
412 | 43 | foreach ($this->ProductClasses as $ProductClass) { |
|
413 | 43 | if (!$ProductClass->isVisible()) { |
|
414 | continue; |
||
415 | } |
||
416 | if (!is_null($ProductClass->getClassCategory1())) { |
||
417 | 18 | return true; |
|
418 | } |
||
419 | } |
||
420 | |||
421 | return false; |
||
422 | } |
||
423 | |||
424 | /** |
||
425 | * @var integer |
||
426 | * |
||
427 | * @ORM\Column(name="id", type="integer", options={"unsigned":true}) |
||
428 | * @ORM\Id |
||
429 | * @ORM\GeneratedValue(strategy="IDENTITY") |
||
430 | */ |
||
431 | private $id; |
||
432 | |||
433 | /** |
||
434 | * @var string |
||
435 | * |
||
436 | * @ORM\Column(name="name", type="string", length=255) |
||
437 | */ |
||
438 | private $name; |
||
439 | |||
440 | /** |
||
441 | * @var string|null |
||
442 | * |
||
443 | * @ORM\Column(name="note", type="string", length=4000, nullable=true) |
||
444 | */ |
||
445 | private $note; |
||
446 | |||
447 | /** |
||
448 | * @var string|null |
||
449 | * |
||
450 | * @ORM\Column(name="description_list", type="string", length=4000, nullable=true) |
||
451 | */ |
||
452 | private $description_list; |
||
453 | |||
454 | /** |
||
455 | * @var string|null |
||
456 | * |
||
457 | * @ORM\Column(name="description_detail", type="string", length=4000, nullable=true) |
||
458 | */ |
||
459 | private $description_detail; |
||
460 | |||
461 | /** |
||
462 | * @var string|null |
||
463 | * |
||
464 | * @ORM\Column(name="search_word", type="string", length=4000, nullable=true) |
||
465 | */ |
||
466 | private $search_word; |
||
467 | |||
468 | /** |
||
469 | * @var string|null |
||
470 | * |
||
471 | * @ORM\Column(name="free_area", type="text", nullable=true) |
||
472 | */ |
||
473 | private $free_area; |
||
474 | |||
475 | /** |
||
476 | * @var \DateTime |
||
477 | * |
||
478 | * @ORM\Column(name="create_date", type="datetimetz") |
||
479 | */ |
||
480 | private $create_date; |
||
481 | |||
482 | /** |
||
483 | * @var \DateTime |
||
484 | * |
||
485 | * @ORM\Column(name="update_date", type="datetimetz") |
||
486 | */ |
||
487 | private $update_date; |
||
488 | |||
489 | /** |
||
490 | * @var \Doctrine\Common\Collections\Collection |
||
491 | * |
||
492 | * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductCategory", mappedBy="Product", cascade={"persist","remove"}) |
||
493 | */ |
||
494 | private $ProductCategories; |
||
495 | |||
496 | /** |
||
497 | * @var \Doctrine\Common\Collections\Collection |
||
498 | * |
||
499 | * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductClass", mappedBy="Product", cascade={"persist","remove"}) |
||
500 | */ |
||
501 | private $ProductClasses; |
||
502 | |||
503 | /** |
||
504 | * @var \Doctrine\Common\Collections\Collection |
||
505 | * |
||
506 | * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductImage", mappedBy="Product", cascade={"remove"}) |
||
507 | * @ORM\OrderBy({ |
||
508 | * "sort_no"="ASC" |
||
509 | * }) |
||
510 | */ |
||
511 | private $ProductImage; |
||
512 | |||
513 | /** |
||
514 | * @var \Doctrine\Common\Collections\Collection |
||
515 | * |
||
516 | * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductTag", mappedBy="Product") |
||
517 | */ |
||
518 | private $ProductTag; |
||
519 | |||
520 | /** |
||
521 | * @var \Doctrine\Common\Collections\Collection |
||
522 | * |
||
523 | * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerFavoriteProduct", mappedBy="Product") |
||
524 | */ |
||
525 | private $CustomerFavoriteProducts; |
||
526 | |||
527 | /** |
||
528 | * @var \Eccube\Entity\Member |
||
529 | * |
||
530 | * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member") |
||
531 | * @ORM\JoinColumns({ |
||
532 | * @ORM\JoinColumn(name="creator_id", referencedColumnName="id") |
||
533 | * }) |
||
534 | */ |
||
535 | private $Creator; |
||
536 | |||
537 | /** |
||
538 | * @var \Eccube\Entity\Master\ProductStatus |
||
539 | * |
||
540 | * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ProductStatus") |
||
541 | * @ORM\JoinColumns({ |
||
542 | * @ORM\JoinColumn(name="product_status_id", referencedColumnName="id") |
||
543 | * }) |
||
544 | */ |
||
545 | private $Status; |
||
546 | 409 | ||
547 | /** |
||
548 | 409 | * Constructor |
|
549 | 409 | */ |
|
550 | 409 | public function __construct() |
|
551 | 409 | { |
|
552 | 409 | $this->ProductCategories = new \Doctrine\Common\Collections\ArrayCollection(); |
|
553 | $this->ProductClasses = new \Doctrine\Common\Collections\ArrayCollection(); |
||
554 | $this->ProductImage = new \Doctrine\Common\Collections\ArrayCollection(); |
||
555 | 1 | $this->ProductTag = new \Doctrine\Common\Collections\ArrayCollection(); |
|
556 | $this->CustomerFavoriteProducts = new \Doctrine\Common\Collections\ArrayCollection(); |
||
557 | 1 | } |
|
558 | |||
559 | public function __clone() |
||
560 | 1 | { |
|
561 | $this->id = null; |
||
562 | } |
||
563 | 1 | ||
564 | public function copy() |
||
565 | 1 | { |
|
566 | 1 | // コピー対象外 |
|
567 | 1 | $this->CustomerFavoriteProducts = new ArrayCollection(); |
|
568 | 1 | ||
569 | 1 | $Categories = $this->getProductCategories(); |
|
570 | 1 | $this->ProductCategories = new ArrayCollection(); |
|
571 | foreach ($Categories as $Category) { |
||
572 | $CopyCategory = clone $Category; |
||
573 | 1 | $this->addProductCategory($CopyCategory); |
|
574 | 1 | $CopyCategory->setProduct($this); |
|
575 | 1 | } |
|
576 | 1 | ||
577 | 1 | $Classes = $this->getProductClasses(); |
|
578 | 1 | $this->ProductClasses = new ArrayCollection(); |
|
579 | foreach ($Classes as $Class) { |
||
580 | $CopyClass = clone $Class; |
||
581 | 1 | $this->addProductClass($CopyClass); |
|
582 | 1 | $CopyClass->setProduct($this); |
|
583 | 1 | } |
|
584 | 1 | ||
585 | 1 | $Images = $this->getProductImage(); |
|
586 | 1 | $this->ProductImage = new ArrayCollection(); |
|
587 | foreach ($Images as $Image) { |
||
588 | $CloneImage = clone $Image; |
||
589 | 1 | $this->addProductImage($CloneImage); |
|
590 | 1 | $CloneImage->setProduct($this); |
|
591 | 1 | } |
|
592 | |||
593 | $Tags = $this->getProductTag(); |
||
594 | $this->ProductTag = new ArrayCollection(); |
||
595 | foreach ($Tags as $Tag) { |
||
596 | $CloneTag = clone $Tag; |
||
597 | 1 | $this->addProductTag($CloneTag); |
|
598 | $CloneTag->setProduct($this); |
||
599 | } |
||
600 | |||
601 | return $this; |
||
602 | } |
||
603 | |||
604 | /** |
||
605 | 418 | * Get id. |
|
606 | * |
||
607 | 418 | * @return int |
|
608 | */ |
||
609 | public function getId() |
||
610 | { |
||
611 | return $this->id; |
||
612 | } |
||
613 | |||
614 | /** |
||
615 | * Set name. |
||
616 | * |
||
617 | 409 | * @param string $name |
|
618 | * |
||
619 | 409 | * @return Product |
|
620 | */ |
||
621 | 409 | public function setName($name) |
|
622 | { |
||
623 | $this->name = $name; |
||
624 | |||
625 | return $this; |
||
626 | } |
||
627 | |||
628 | /** |
||
629 | 279 | * Get name. |
|
630 | * |
||
631 | 279 | * @return string |
|
632 | */ |
||
633 | public function getName() |
||
634 | { |
||
635 | return $this->name; |
||
636 | } |
||
637 | |||
638 | /** |
||
639 | * Set note. |
||
640 | * |
||
641 | 25 | * @param string|null $note |
|
642 | * |
||
643 | 25 | * @return Product |
|
644 | */ |
||
645 | 25 | public function setNote($note = null) |
|
646 | { |
||
647 | $this->note = $note; |
||
648 | |||
649 | return $this; |
||
650 | } |
||
651 | |||
652 | /** |
||
653 | 18 | * Get note. |
|
654 | * |
||
655 | 18 | * @return string|null |
|
656 | */ |
||
657 | public function getNote() |
||
658 | { |
||
659 | return $this->note; |
||
660 | } |
||
661 | |||
662 | /** |
||
663 | * Set descriptionList. |
||
664 | * |
||
665 | 406 | * @param string|null $descriptionList |
|
666 | * |
||
667 | 406 | * @return Product |
|
668 | */ |
||
669 | 406 | public function setDescriptionList($descriptionList = null) |
|
670 | { |
||
671 | $this->description_list = $descriptionList; |
||
672 | |||
673 | return $this; |
||
674 | } |
||
675 | |||
676 | /** |
||
677 | 20 | * Get descriptionList. |
|
678 | * |
||
679 | 20 | * @return string|null |
|
680 | */ |
||
681 | public function getDescriptionList() |
||
682 | { |
||
683 | return $this->description_list; |
||
684 | } |
||
685 | |||
686 | /** |
||
687 | * Set descriptionDetail. |
||
688 | * |
||
689 | 406 | * @param string|null $descriptionDetail |
|
690 | * |
||
691 | 406 | * @return Product |
|
692 | */ |
||
693 | 406 | public function setDescriptionDetail($descriptionDetail = null) |
|
694 | { |
||
695 | $this->description_detail = $descriptionDetail; |
||
696 | |||
697 | return $this; |
||
698 | } |
||
699 | |||
700 | /** |
||
701 | 29 | * Get descriptionDetail. |
|
702 | * |
||
703 | 29 | * @return string|null |
|
704 | */ |
||
705 | public function getDescriptionDetail() |
||
706 | { |
||
707 | return $this->description_detail; |
||
708 | } |
||
709 | |||
710 | /** |
||
711 | * Set searchWord. |
||
712 | * |
||
713 | 23 | * @param string|null $searchWord |
|
714 | * |
||
715 | 23 | * @return Product |
|
716 | */ |
||
717 | 23 | public function setSearchWord($searchWord = null) |
|
718 | { |
||
719 | $this->search_word = $searchWord; |
||
720 | |||
721 | return $this; |
||
722 | } |
||
723 | |||
724 | /** |
||
725 | 18 | * Get searchWord. |
|
726 | * |
||
727 | 18 | * @return string|null |
|
728 | */ |
||
729 | public function getSearchWord() |
||
730 | { |
||
731 | return $this->search_word; |
||
732 | } |
||
733 | |||
734 | /** |
||
735 | * Set freeArea. |
||
736 | * |
||
737 | 25 | * @param string|null $freeArea |
|
738 | * |
||
739 | 25 | * @return Product |
|
740 | */ |
||
741 | 25 | public function setFreeArea($freeArea = null) |
|
742 | { |
||
743 | $this->free_area = $freeArea; |
||
744 | |||
745 | return $this; |
||
746 | } |
||
747 | |||
748 | /** |
||
749 | 29 | * Get freeArea. |
|
750 | * |
||
751 | 29 | * @return string|null |
|
752 | */ |
||
753 | public function getFreeArea() |
||
754 | { |
||
755 | return $this->free_area; |
||
756 | } |
||
757 | |||
758 | /** |
||
759 | * Set createDate. |
||
760 | * |
||
761 | 408 | * @param \DateTime $createDate |
|
762 | * |
||
763 | 408 | * @return Product |
|
764 | */ |
||
765 | 408 | public function setCreateDate($createDate) |
|
766 | { |
||
767 | $this->create_date = $createDate; |
||
768 | |||
769 | return $this; |
||
770 | } |
||
771 | |||
772 | /** |
||
773 | 8 | * Get createDate. |
|
774 | * |
||
775 | 8 | * @return \DateTime |
|
776 | */ |
||
777 | public function getCreateDate() |
||
778 | { |
||
779 | return $this->create_date; |
||
780 | } |
||
781 | |||
782 | /** |
||
783 | * Set updateDate. |
||
784 | * |
||
785 | 409 | * @param \DateTime $updateDate |
|
786 | * |
||
787 | 409 | * @return Product |
|
788 | */ |
||
789 | 409 | public function setUpdateDate($updateDate) |
|
790 | { |
||
791 | $this->update_date = $updateDate; |
||
792 | |||
793 | return $this; |
||
794 | } |
||
795 | |||
796 | /** |
||
797 | 7 | * Get updateDate. |
|
798 | * |
||
799 | 7 | * @return \DateTime |
|
800 | */ |
||
801 | public function getUpdateDate() |
||
802 | { |
||
803 | return $this->update_date; |
||
804 | } |
||
805 | |||
806 | /** |
||
807 | * Add productCategory. |
||
808 | * |
||
809 | 398 | * @param \Eccube\Entity\ProductCategory $productCategory |
|
810 | * |
||
811 | 398 | * @return Product |
|
812 | */ |
||
813 | 398 | public function addProductCategory(\Eccube\Entity\ProductCategory $productCategory) |
|
814 | { |
||
815 | $this->ProductCategories[] = $productCategory; |
||
816 | |||
817 | return $this; |
||
818 | } |
||
819 | |||
820 | /** |
||
821 | * Remove productCategory. |
||
822 | * |
||
823 | 12 | * @param \Eccube\Entity\ProductCategory $productCategory |
|
824 | * |
||
825 | 12 | * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. |
|
826 | */ |
||
827 | public function removeProductCategory(\Eccube\Entity\ProductCategory $productCategory) |
||
828 | { |
||
829 | return $this->ProductCategories->removeElement($productCategory); |
||
830 | } |
||
831 | |||
832 | /** |
||
833 | 38 | * Get productCategories. |
|
834 | * |
||
835 | 38 | * @return \Doctrine\Common\Collections\Collection |
|
836 | */ |
||
837 | public function getProductCategories() |
||
838 | { |
||
839 | return $this->ProductCategories; |
||
840 | } |
||
841 | |||
842 | /** |
||
843 | * Add productClass. |
||
844 | * |
||
845 | 409 | * @param \Eccube\Entity\ProductClass $productClass |
|
846 | * |
||
847 | 409 | * @return Product |
|
848 | */ |
||
849 | 409 | public function addProductClass(\Eccube\Entity\ProductClass $productClass) |
|
850 | { |
||
851 | $this->ProductClasses[] = $productClass; |
||
852 | |||
853 | return $this; |
||
854 | } |
||
855 | |||
856 | /** |
||
857 | * Remove productClass. |
||
858 | * |
||
859 | * @param \Eccube\Entity\ProductClass $productClass |
||
860 | * |
||
861 | * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. |
||
862 | */ |
||
863 | public function removeProductClass(\Eccube\Entity\ProductClass $productClass) |
||
864 | { |
||
865 | return $this->ProductClasses->removeElement($productClass); |
||
866 | } |
||
867 | |||
868 | /** |
||
869 | 375 | * Get productClasses. |
|
870 | * |
||
871 | 375 | * @return \Doctrine\Common\Collections\Collection |
|
872 | */ |
||
873 | public function getProductClasses() |
||
874 | { |
||
875 | return $this->ProductClasses; |
||
876 | } |
||
877 | |||
878 | /** |
||
879 | * Add productImage. |
||
880 | * |
||
881 | 398 | * @param \Eccube\Entity\ProductImage $productImage |
|
882 | * |
||
883 | 398 | * @return Product |
|
884 | */ |
||
885 | 398 | public function addProductImage(\Eccube\Entity\ProductImage $productImage) |
|
886 | { |
||
887 | $this->ProductImage[] = $productImage; |
||
888 | |||
889 | return $this; |
||
890 | } |
||
891 | |||
892 | /** |
||
893 | * Remove productImage. |
||
894 | * |
||
895 | 2 | * @param \Eccube\Entity\ProductImage $productImage |
|
896 | * |
||
897 | 2 | * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. |
|
898 | */ |
||
899 | public function removeProductImage(\Eccube\Entity\ProductImage $productImage) |
||
900 | { |
||
901 | return $this->ProductImage->removeElement($productImage); |
||
902 | } |
||
903 | |||
904 | /** |
||
905 | 95 | * Get productImage. |
|
906 | * |
||
907 | 95 | * @return \Doctrine\Common\Collections\Collection |
|
908 | */ |
||
909 | public function getProductImage() |
||
910 | { |
||
911 | return $this->ProductImage; |
||
912 | } |
||
913 | |||
914 | /** |
||
915 | * Add productTag. |
||
916 | * |
||
917 | 18 | * @param \Eccube\Entity\ProductTag $productTag |
|
918 | * |
||
919 | 18 | * @return Product |
|
920 | */ |
||
921 | 18 | public function addProductTag(\Eccube\Entity\ProductTag $productTag) |
|
922 | { |
||
923 | $this->ProductTag[] = $productTag; |
||
924 | |||
925 | return $this; |
||
926 | } |
||
927 | |||
928 | /** |
||
929 | * Remove productTag. |
||
930 | * |
||
931 | 2 | * @param \Eccube\Entity\ProductTag $productTag |
|
932 | * |
||
933 | 2 | * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. |
|
934 | */ |
||
935 | public function removeProductTag(\Eccube\Entity\ProductTag $productTag) |
||
936 | { |
||
937 | return $this->ProductTag->removeElement($productTag); |
||
938 | } |
||
939 | |||
940 | /** |
||
941 | 40 | * Get productTag. |
|
942 | * |
||
943 | 40 | * @return \Doctrine\Common\Collections\Collection |
|
944 | */ |
||
945 | public function getProductTag() |
||
946 | { |
||
947 | return $this->ProductTag; |
||
948 | } |
||
949 | |||
950 | /** |
||
951 | * Get Tag |
||
952 | 31 | * フロント側タグsort_no順の配列を作成する |
|
953 | * |
||
954 | 31 | * @return []Tag |
|
955 | */ |
||
956 | 31 | public function getTags() |
|
957 | 1 | { |
|
958 | $tags = []; |
||
959 | |||
960 | 31 | foreach ($this->getProductTag() as $productTag) { |
|
961 | $tags[] = $productTag->getTag(); |
||
962 | 31 | } |
|
963 | |||
964 | 31 | usort($tags, function (Tag $tag1, Tag $tag2) { |
|
965 | return $tag1->getSortNo() < $tag2->getSortNo(); |
||
966 | }); |
||
967 | |||
968 | return $tags; |
||
969 | } |
||
970 | |||
971 | /** |
||
972 | * Add customerFavoriteProduct. |
||
973 | * |
||
974 | * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct |
||
975 | * |
||
976 | * @return Product |
||
977 | */ |
||
978 | public function addCustomerFavoriteProduct(\Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct) |
||
979 | { |
||
980 | $this->CustomerFavoriteProducts[] = $customerFavoriteProduct; |
||
981 | |||
982 | return $this; |
||
983 | } |
||
984 | |||
985 | /** |
||
986 | * Remove customerFavoriteProduct. |
||
987 | * |
||
988 | * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct |
||
989 | * |
||
990 | * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. |
||
991 | */ |
||
992 | public function removeCustomerFavoriteProduct(\Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct) |
||
993 | { |
||
994 | return $this->CustomerFavoriteProducts->removeElement($customerFavoriteProduct); |
||
995 | } |
||
996 | |||
997 | /** |
||
998 | * Get customerFavoriteProducts. |
||
999 | * |
||
1000 | * @return \Doctrine\Common\Collections\Collection |
||
1001 | */ |
||
1002 | public function getCustomerFavoriteProducts() |
||
1003 | { |
||
1004 | return $this->CustomerFavoriteProducts; |
||
1005 | } |
||
1006 | |||
1007 | /** |
||
1008 | * Set creator. |
||
1009 | * |
||
1010 | 408 | * @param \Eccube\Entity\Member|null $creator |
|
1011 | * |
||
1012 | 408 | * @return Product |
|
1013 | */ |
||
1014 | 408 | public function setCreator(\Eccube\Entity\Member $creator = null) |
|
1015 | { |
||
1016 | $this->Creator = $creator; |
||
1017 | |||
1018 | return $this; |
||
1019 | } |
||
1020 | |||
1021 | /** |
||
1022 | 12 | * Get creator. |
|
1023 | * |
||
1024 | 12 | * @return \Eccube\Entity\Member|null |
|
1025 | */ |
||
1026 | public function getCreator() |
||
1027 | { |
||
1028 | return $this->Creator; |
||
1029 | } |
||
1030 | |||
1031 | /** |
||
1032 | * Set status. |
||
1033 | * |
||
1034 | 406 | * @param \Eccube\Entity\Master\ProductStatus|null $status |
|
1035 | * |
||
1036 | 406 | * @return Product |
|
1037 | */ |
||
1038 | 406 | public function setStatus(\Eccube\Entity\Master\ProductStatus $status = null) |
|
1039 | { |
||
1040 | $this->Status = $status; |
||
1041 | |||
1042 | return $this; |
||
1043 | } |
||
1044 | |||
1045 | /** |
||
1046 | 106 | * Get status. |
|
1047 | * |
||
1048 | 106 | * @return \Eccube\Entity\Master\ProductStatus|null |
|
1049 | */ |
||
1050 | public function getStatus() |
||
1051 | { |
||
1052 | return $this->Status; |
||
1053 | } |
||
1054 | } |
||
1055 | } |
||
1056 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.