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