1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Silverback\ApiComponentBundle\Entity\Component\Feature\Stacked; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Core\Annotation\ApiResource; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Silverback\ApiComponentBundle\Entity\Component\Feature\AbstractFeatureItem; |
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
9
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
10
|
|
|
use Symfony\Component\Validator\Mapping\ClassMetadata; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Class FeatureStackedItem |
14
|
|
|
* @package Silverback\ApiComponentBundle\Entity\Component\FeatureList |
15
|
|
|
* @author Daniel West <[email protected]> |
16
|
|
|
* @ApiResource(shortName="component/feature_stacked_items") |
17
|
|
|
* @ORM\Entity() |
18
|
|
|
*/ |
19
|
|
|
class FeatureStackedItem extends AbstractFeatureItem |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @Groups({"component", "content"}) |
23
|
|
|
* @var null|string |
24
|
|
|
*/ |
25
|
|
|
protected $description; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @Groups({"component", "content"}) |
29
|
|
|
* @var null|string |
30
|
|
|
*/ |
31
|
|
|
protected $buttonText; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @Groups({"component", "content"}) |
35
|
|
|
* @var null|string |
36
|
|
|
*/ |
37
|
|
|
protected $buttonClass; |
38
|
|
|
|
39
|
1 |
|
public static function loadValidatorMetadata(ClassMetadata $metadata) |
40
|
|
|
{ |
41
|
1 |
|
$metadata->addPropertyConstraint( |
42
|
1 |
|
'description', |
43
|
1 |
|
new Assert\NotBlank() |
44
|
|
|
); |
45
|
1 |
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return null|string |
49
|
|
|
*/ |
50
|
1 |
|
public function getDescription(): ?string |
51
|
|
|
{ |
52
|
1 |
|
return $this->description; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param null|string $description |
57
|
|
|
*/ |
58
|
1 |
|
public function setDescription(?string $description): void |
59
|
|
|
{ |
60
|
1 |
|
$this->description = $description; |
61
|
1 |
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return null|string |
65
|
|
|
*/ |
66
|
1 |
|
public function getButtonText(): ?string |
67
|
|
|
{ |
68
|
1 |
|
return $this->buttonText; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param null|string $buttonText |
73
|
|
|
*/ |
74
|
1 |
|
public function setButtonText(?string $buttonText): void |
75
|
|
|
{ |
76
|
1 |
|
$this->buttonText = $buttonText; |
77
|
1 |
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @return null|string |
81
|
|
|
*/ |
82
|
1 |
|
public function getButtonClass(): ?string |
83
|
|
|
{ |
84
|
1 |
|
return $this->buttonClass; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @param null|string $buttonClass |
89
|
|
|
*/ |
90
|
1 |
|
public function setButtonClass(?string $buttonClass): void |
91
|
|
|
{ |
92
|
1 |
|
$this->buttonClass = $buttonClass; |
93
|
1 |
|
} |
94
|
|
|
} |
95
|
|
|
|