1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* WellCommerce Open-Source E-Commerce Platform |
4
|
|
|
* |
5
|
|
|
* This file is part of the WellCommerce package. |
6
|
|
|
* |
7
|
|
|
* (c) Adam Piotrowski <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, |
10
|
|
|
* please view the LICENSE file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace WellCommerce\Bundle\CatalogBundle\Entity; |
14
|
|
|
|
15
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
16
|
|
|
use Doctrine\Common\Collections\Collection; |
17
|
|
|
use Knp\DoctrineBehaviors\Model\Blameable\Blameable; |
18
|
|
|
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable; |
19
|
|
|
use Knp\DoctrineBehaviors\Model\Translatable\Translatable; |
20
|
|
|
use WellCommerce\Bundle\CoreBundle\Entity\EntityInterface; |
21
|
|
|
use WellCommerce\Bundle\AppBundle\Entity\Media; |
22
|
|
|
use WellCommerce\Bundle\AppBundle\Entity\ShopCollectionAwareTrait; |
23
|
|
|
use WellCommerce\Bundle\CoreBundle\Doctrine\Behaviours\Identifiable; |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Class ProducerCollection |
28
|
|
|
* |
29
|
|
|
* @author Rafał Martonik <[email protected]> |
30
|
|
|
*/ |
31
|
|
|
class ProducerCollection implements EntityInterface |
32
|
|
|
{ |
33
|
|
|
use Identifiable; |
34
|
|
|
use Translatable; |
35
|
|
|
use Timestampable; |
36
|
|
|
use Blameable; |
37
|
|
|
use ShopCollectionAwareTrait; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var Collection |
41
|
|
|
*/ |
42
|
|
|
protected $products; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var Media |
46
|
|
|
*/ |
47
|
|
|
protected $photo; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var Producer |
51
|
|
|
*/ |
52
|
|
|
protected $producer; |
53
|
|
|
|
54
|
|
|
public function __construct() |
55
|
|
|
{ |
56
|
|
|
$this->products = new ArrayCollection(); |
57
|
|
|
$this->shops = new ArrayCollection(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getProducts(): Collection |
61
|
|
|
{ |
62
|
|
|
return $this->products; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function getPhoto() |
66
|
|
|
{ |
67
|
|
|
return $this->photo; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function setPhoto(Media $photo = null) |
71
|
|
|
{ |
72
|
|
|
$this->photo = $photo; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getProducer() |
76
|
|
|
{ |
77
|
|
|
return $this->producer; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function setProducer(Producer $producer = null) |
81
|
|
|
{ |
82
|
|
|
$this->producer = $producer; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function translate($locale = null, $fallbackToDefault = true): ProducerCollectionTranslation |
86
|
|
|
{ |
87
|
|
|
return $this->doTranslate($locale, $fallbackToDefault); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
} |
91
|
|
|
|