1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file was created by the developers from BitBag. |
5
|
|
|
* Feel free to contact us once you face any issues or want to start |
6
|
|
|
* another great project. |
7
|
|
|
* You can find more information about us on https://bitbag.shop and write us |
8
|
|
|
* an email on [email protected]. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
declare(strict_types=1); |
12
|
|
|
|
13
|
|
|
namespace BitBag\CmsPlugin\Entity; |
14
|
|
|
|
15
|
|
|
use Sylius\Component\Core\Model\ImageInterface; |
16
|
|
|
use Sylius\Component\Resource\Model\ToggleableTrait; |
17
|
|
|
use Sylius\Component\Resource\Model\TranslatableTrait; |
18
|
|
|
use Sylius\Component\Resource\Model\TranslationInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Patryk Drapik <[email protected]> |
22
|
|
|
* @author Mikołaj Król <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class Block implements BlockInterface |
25
|
|
|
{ |
26
|
|
|
use ToggleableTrait; |
27
|
|
|
use TranslatableTrait { |
28
|
|
|
__construct as protected initializeTranslationsCollection; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function __construct() |
32
|
|
|
{ |
33
|
|
|
$this->initializeTranslationsCollection(); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var null|int |
38
|
|
|
*/ |
39
|
|
|
protected $id; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var null|string |
43
|
|
|
*/ |
44
|
|
|
protected $code; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var null|string |
48
|
|
|
*/ |
49
|
|
|
protected $type; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* {@inheritdoc} |
53
|
|
|
*/ |
54
|
|
|
public function getId(): ?int |
55
|
|
|
{ |
56
|
|
|
return $this->id; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* {@inheritdoc} |
61
|
|
|
*/ |
62
|
|
|
public function getCode(): ?string |
63
|
|
|
{ |
64
|
|
|
return $this->code; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* {@inheritdoc} |
69
|
|
|
*/ |
70
|
|
|
public function setCode(?string $code): void |
71
|
|
|
{ |
72
|
|
|
$this->code = $code; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* {@inheritdoc} |
77
|
|
|
*/ |
78
|
|
|
public function getType(): ?string |
79
|
|
|
{ |
80
|
|
|
return $this->type; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* {@inheritdoc} |
85
|
|
|
*/ |
86
|
|
|
public function setType(?string $type): void |
87
|
|
|
{ |
88
|
|
|
$this->type = $type; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* {@inheritdoc} |
93
|
|
|
*/ |
94
|
|
|
public function getName(): ?string |
95
|
|
|
{ |
96
|
|
|
return $this->getBlockTranslation()->getName(); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* {@inheritdoc} |
101
|
|
|
*/ |
102
|
|
|
public function setName(?string $name): void |
103
|
|
|
{ |
104
|
|
|
$this->getBlockTranslation()->setName($name); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* {@inheritdoc} |
109
|
|
|
*/ |
110
|
|
|
public function getContent(): ?string |
111
|
|
|
{ |
112
|
|
|
return $this->getBlockTranslation()->getContent(); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* {@inheritdoc} |
117
|
|
|
*/ |
118
|
|
|
public function setContent(?string $content): void |
119
|
|
|
{ |
120
|
|
|
$this->getBlockTranslation()->setContent($content); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* {@inheritdoc} |
125
|
|
|
*/ |
126
|
|
|
public function getImage(): ?ImageInterface |
127
|
|
|
{ |
128
|
|
|
return $this->getBlockTranslation()->getImage(); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* {@inheritdoc} |
133
|
|
|
*/ |
134
|
|
|
public function setImage(?ImageInterface $image): void |
135
|
|
|
{ |
136
|
|
|
$this->getBlockTranslation()->setImage($image); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* {@inheritdoc} |
141
|
|
|
*/ |
142
|
|
|
public function getLink(): ?string |
143
|
|
|
{ |
144
|
|
|
return $this->getBlockTranslation()->getLink(); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* {@inheritdoc} |
149
|
|
|
*/ |
150
|
|
|
public function setLink(?string $link): void |
151
|
|
|
{ |
152
|
|
|
$this->getBlockTranslation()->setLink($link); |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return BlockTranslationInterface|TranslationInterface |
157
|
|
|
*/ |
158
|
|
|
protected function getBlockTranslation(): TranslationInterface |
159
|
|
|
{ |
160
|
|
|
return $this->getTranslation(); |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* {@inheritdoc} |
165
|
|
|
*/ |
166
|
|
|
protected function createTranslation(): BlockTranslation |
167
|
|
|
{ |
168
|
|
|
return new BlockTranslation(); |
169
|
|
|
} |
170
|
|
|
} |
171
|
|
|
|