1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Silverback API Components Bundle Project |
5
|
|
|
* |
6
|
|
|
* (c) Daniel West <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace Silverback\ApiComponentsBundle\Entity\Component; |
15
|
|
|
|
16
|
|
|
use ApiPlatform\Core\Annotation\ApiProperty; |
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
18
|
|
|
use Silverback\ApiComponentsBundle\Entity\Core\AbstractComponent; |
19
|
|
|
use Silverback\ApiComponentsBundle\Validator\Constraints as AcbAssert; |
20
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @author Daniel West <[email protected]> |
24
|
|
|
* |
25
|
|
|
* @ORM\Entity |
26
|
|
|
*/ |
27
|
|
|
class Collection extends AbstractComponent |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @ORM\Column(nullable=false) |
31
|
|
|
* @Assert\NotNull(message="The resource iri for a collection component is required") |
32
|
|
|
* @AcbAssert\ResourceIri() |
33
|
|
|
*/ |
34
|
|
|
private ?string $resourceIri; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @ORM\Column(type="integer", nullable=true) |
38
|
|
|
*/ |
39
|
|
|
private ?int $perPage = null; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @ORM\Column(type="json", nullable=true) |
43
|
|
|
*/ |
44
|
|
|
private ?array $defaultQueryParameters = null; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @ApiProperty(writable=false) |
48
|
|
|
*/ |
49
|
|
|
private ?array $collection = null; |
50
|
|
|
|
51
|
|
|
public function getResourceIri(): ?string |
52
|
|
|
{ |
53
|
|
|
return $this->resourceIri; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function setResourceIri(?string $resourceIri): self |
57
|
|
|
{ |
58
|
|
|
$this->resourceIri = $resourceIri; |
59
|
|
|
|
60
|
|
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getPerPage(): ?int |
64
|
|
|
{ |
65
|
|
|
return $this->perPage; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function setPerPage(?int $perPage): self |
69
|
|
|
{ |
70
|
|
|
$this->perPage = $perPage; |
71
|
|
|
|
72
|
|
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function getDefaultQueryParameters(): ?array |
76
|
|
|
{ |
77
|
|
|
return $this->defaultQueryParameters; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function setDefaultQueryParameters(?array $defaultQueryParameters): self |
81
|
|
|
{ |
82
|
|
|
$this->defaultQueryParameters = $defaultQueryParameters; |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getCollection(): ?array |
88
|
|
|
{ |
89
|
|
|
return $this->collection; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function setCollection(?array $collection): self |
93
|
|
|
{ |
94
|
|
|
$this->collection = $collection; |
95
|
|
|
|
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|