1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainFoundation\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\CategoryInterface; |
8
|
|
|
use Loevgaard\DandomainFoundation\Entity\Generated\CategoryTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity() |
12
|
|
|
* @ORM\Table(name="loevgaard_dandomain_categories") |
13
|
|
|
*/ |
14
|
|
|
class Category implements CategoryInterface |
15
|
|
|
{ |
16
|
|
|
use CategoryTrait; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var int |
20
|
|
|
* |
21
|
|
|
* @ORM\Id |
22
|
|
|
* @ORM\GeneratedValue |
23
|
|
|
* @ORM\Column(type="integer") |
24
|
|
|
**/ |
25
|
|
|
protected $id; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var int |
29
|
|
|
* |
30
|
|
|
* @ORM\Column(type="integer", unique=true) |
31
|
|
|
*/ |
32
|
|
|
protected $externalId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var string|null |
36
|
|
|
* |
37
|
|
|
* @ORM\Column(nullable=true, type="string", length=191) |
38
|
|
|
*/ |
39
|
|
|
protected $b2bGroupId; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var \DateTimeImmutable|null |
43
|
|
|
* |
44
|
|
|
* @ORM\Column(nullable=true, type="datetime_immutable") |
45
|
|
|
*/ |
46
|
|
|
protected $createdDate; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var int|null |
50
|
|
|
* |
51
|
|
|
* @ORM\Column(nullable=true, type="integer") |
52
|
|
|
*/ |
53
|
|
|
protected $customInfoLayout; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var int|null |
57
|
|
|
* |
58
|
|
|
* @ORM\Column(nullable=true, type="integer") |
59
|
|
|
*/ |
60
|
|
|
protected $customListLayout; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var int|null |
64
|
|
|
* |
65
|
|
|
* @ORM\Column(nullable=true, type="integer") |
66
|
|
|
*/ |
67
|
|
|
protected $defaultParentId; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var \DateTimeImmutable|null |
71
|
|
|
* |
72
|
|
|
* @ORM\Column(nullable=true, type="datetime_immutable") |
73
|
|
|
*/ |
74
|
|
|
protected $editedDate; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var int|null |
78
|
|
|
* |
79
|
|
|
* @ORM\Column(nullable=true, type="integer") |
80
|
|
|
*/ |
81
|
|
|
protected $infoLayout; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @var int|null |
85
|
|
|
* |
86
|
|
|
* @ORM\Column(nullable=true, type="integer") |
87
|
|
|
*/ |
88
|
|
|
protected $internalId; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var int|null |
92
|
|
|
* |
93
|
|
|
* @ORM\Column(nullable=true, type="integer") |
94
|
|
|
*/ |
95
|
|
|
protected $listLayout; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @var bool|null |
99
|
|
|
* |
100
|
|
|
* @ORM\Column(nullable=true, type="boolean") |
101
|
|
|
*/ |
102
|
|
|
protected $modified; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @var array|null |
106
|
|
|
* |
107
|
|
|
* @ORM\Column(nullable=true, type="json") |
108
|
|
|
*/ |
109
|
|
|
protected $parentIdList; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @var array|null |
113
|
|
|
* |
114
|
|
|
* @ORM\Column(nullable=true, type="json") |
115
|
|
|
*/ |
116
|
|
|
protected $segmentIdList; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @var Category[]|ArrayCollection |
120
|
|
|
* |
121
|
|
|
* @ORM\ManyToMany(mappedBy="parentCategories", targetEntity="Category") |
122
|
|
|
*/ |
123
|
|
|
protected $childrenCategories; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @var Category[]|ArrayCollection |
127
|
|
|
* |
128
|
|
|
* @ORM\JoinTable(name="loevgaard_dandomain_category_parents") |
129
|
|
|
* @ORM\ManyToMany(cascade={"persist"}, inversedBy="childrenCategories", targetEntity="Category") |
130
|
|
|
*/ |
131
|
|
|
protected $parentCategories; |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @var Product[]||ArrayCollection |
135
|
|
|
* |
136
|
|
|
* @ORM\ManyToMany(mappedBy="categories", targetEntity="Product") |
137
|
|
|
*/ |
|
|
|
|
138
|
|
|
protected $products; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @var Segment[]|ArrayCollection |
142
|
|
|
* |
143
|
|
|
* @ORM\JoinTable(name="loevgaard_dandomain_category_segments") |
144
|
|
|
* @ORM\ManyToMany(cascade={"persist"}, inversedBy="categories", targetEntity="Segment") |
145
|
|
|
*/ |
146
|
|
|
protected $segments; |
147
|
|
|
|
148
|
|
|
public function __construct() |
149
|
|
|
{ |
150
|
|
|
$this->childrenCategories = new ArrayCollection(); |
151
|
|
|
$this->parentCategories = new ArrayCollection(); |
152
|
|
|
$this->products = new ArrayCollection(); |
153
|
|
|
$this->segments = new ArrayCollection(); |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
|