|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Zenify\DoctrineBehaviors\Tests\Entities\Source; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
9
|
|
|
use Knp\DoctrineBehaviors\Model\Translatable\Translation; |
|
10
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @ORM\Entity |
|
14
|
|
|
*/ |
|
15
|
|
|
class CategoryTranslation |
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
|
|
use Translation; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @ORM\Column(type="string") |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private $name; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @ORM\Column(type="boolean") |
|
28
|
|
|
* @var bool |
|
29
|
|
|
*/ |
|
30
|
|
|
private $isActive; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @ORM\ManyToMany(targetEntity="Tag", inversedBy="categories", cascade={"persist"}) |
|
34
|
|
|
* @var Tag[]|ArrayCollection |
|
35
|
|
|
*/ |
|
36
|
|
|
private $tags; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @ORM\Column(type="boolean") |
|
40
|
|
|
* @var bool |
|
41
|
|
|
*/ |
|
42
|
|
|
private $shouldRenderSubcategories; |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
public function __construct() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->tags = new ArrayCollection; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @return string |
|
53
|
|
|
*/ |
|
54
|
|
|
public function getName() |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->name; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param string $name |
|
62
|
|
|
*/ |
|
63
|
|
|
public function setName($name) |
|
64
|
|
|
{ |
|
65
|
|
|
$this->name = $name; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @return bool |
|
71
|
|
|
*/ |
|
72
|
|
|
public function isActive() |
|
73
|
|
|
{ |
|
74
|
|
|
return $this->isActive; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param bool $isActive |
|
80
|
|
|
*/ |
|
81
|
|
|
public function setIsActive($isActive) |
|
82
|
|
|
{ |
|
83
|
|
|
$this->isActive = $isActive; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @return Tag[]|ArrayCollection |
|
89
|
|
|
*/ |
|
90
|
|
|
public function getTags() |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->tags; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @param Tag $tag |
|
98
|
|
|
* @return bool |
|
99
|
|
|
*/ |
|
100
|
|
|
public function hasTag(Tag $tag) |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->tags->contains($tag); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
|
|
106
|
|
|
public function addTag(Tag $tag) |
|
107
|
|
|
{ |
|
108
|
|
|
$this->tags->add($tag); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return bool |
|
114
|
|
|
*/ |
|
115
|
|
|
public function shouldRenderSubcategories() |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->shouldRenderSubcategories; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @param bool $shouldRenderSubcategories |
|
123
|
|
|
*/ |
|
124
|
|
|
public function setShouldRenderSubcategories($shouldRenderSubcategories) |
|
125
|
|
|
{ |
|
126
|
|
|
$this->shouldRenderSubcategories = $shouldRenderSubcategories; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
} |
|
130
|
|
|
|