1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Silverback\ApiComponentBundle\Entity\Content\Component\Collection; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Core\Annotation\ApiResource; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Silverback\ApiComponentBundle\Entity\Content\Component\AbstractComponent; |
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity() |
12
|
|
|
* @ApiResource() |
13
|
|
|
* @author Daniel West <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class Collection extends AbstractComponent |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @ORM\Column() |
19
|
|
|
* @Groups({"component", "content"}) |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
private $resource; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @ORM\Column(type="integer") |
26
|
|
|
* @Groups({"component", "content"}) |
27
|
|
|
* @var int |
28
|
|
|
*/ |
29
|
|
|
private $perPage = 12; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @ORM\Column(nullable=true) |
33
|
|
|
* @Groups({"component", "content"}) |
34
|
|
|
* @var string|null |
35
|
|
|
*/ |
36
|
|
|
private $title; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var array|\Traversable |
40
|
1 |
|
* @Groups({"component_read", "content_read"}) |
41
|
|
|
*/ |
42
|
1 |
|
private $collection; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return string |
46
|
|
|
*/ |
47
|
|
|
public function getResource(): string |
48
|
2 |
|
{ |
49
|
|
|
return $this->resource; |
50
|
2 |
|
} |
51
|
2 |
|
|
52
|
|
|
/** |
53
|
|
|
* @param string $resource |
54
|
|
|
*/ |
55
|
|
|
public function setResource(string $resource): void |
56
|
1 |
|
{ |
57
|
|
|
$this->resource = $resource; |
58
|
1 |
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return int |
62
|
|
|
*/ |
63
|
|
|
public function getPerPage(): int |
64
|
1 |
|
{ |
65
|
|
|
return $this->perPage; |
66
|
1 |
|
} |
67
|
1 |
|
|
68
|
|
|
/** |
69
|
|
|
* @param int $perPage |
70
|
|
|
*/ |
71
|
|
|
public function setPerPage(int $perPage): void |
72
|
|
|
{ |
73
|
|
|
$this->perPage = $perPage; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return null|string |
78
|
|
|
*/ |
79
|
|
|
public function getTitle(): ?string |
80
|
|
|
{ |
81
|
|
|
return $this->title; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param null|string $title |
86
|
|
|
*/ |
87
|
|
|
public function setTitle(?string $title): void |
88
|
|
|
{ |
89
|
|
|
$this->title = $title; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return array|\Traversable |
94
|
|
|
*/ |
95
|
|
|
public function getCollection() |
96
|
|
|
{ |
97
|
|
|
return $this->collection; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @param array|\Traversable $collection |
102
|
|
|
*/ |
103
|
|
|
public function setCollection($collection): void |
104
|
|
|
{ |
105
|
|
|
$this->collection = $collection; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @ORM\PostLoad() |
110
|
|
|
*/ |
111
|
|
|
public function postLoad() { |
112
|
|
|
|
113
|
|
|
} |
114
|
|
|
} |
115
|
|
|
|