1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Silverback API Component 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\ApiComponentBundle\Entity\Component; |
15
|
|
|
|
16
|
|
|
use Doctrine\ORM\Mapping as ORM; |
17
|
|
|
use Silverback\ApiComponentBundle\Entity\Core\AbstractComponent; |
18
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @author Daniel West <[email protected]> |
22
|
|
|
* @ORM\Entity |
23
|
|
|
*/ |
24
|
|
|
class Collection extends AbstractComponent |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* @ORM\Column(nullable=false) |
28
|
|
|
* @Assert\NotNull(message="The resource class for a collection component is required") |
29
|
|
|
*/ |
30
|
|
|
private string $resourceClass; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @ORM\Column(type="integer", nullable=true) |
34
|
|
|
*/ |
35
|
|
|
private ?int $perPage; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @ORM\Column(type="array", nullable=true) |
39
|
|
|
*/ |
40
|
|
|
private ?array $defaultQueryParameters; |
41
|
|
|
|
42
|
|
|
public function getResourceClass(): string |
43
|
|
|
{ |
44
|
|
|
return $this->resourceClass; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function setResourceClass(string $resourceClass): self |
48
|
|
|
{ |
49
|
|
|
$this->resourceClass = $resourceClass; |
50
|
|
|
|
51
|
|
|
return $this; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getPerPage(): ?int |
55
|
|
|
{ |
56
|
|
|
return $this->perPage; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setPerPage(?int $perPage): self |
60
|
|
|
{ |
61
|
|
|
$this->perPage = $perPage; |
62
|
|
|
|
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getDefaultQueryParameters(): ?array |
67
|
|
|
{ |
68
|
|
|
return $this->defaultQueryParameters; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function setDefaultQueryParameters(?array $defaultQueryParameters): self |
72
|
|
|
{ |
73
|
|
|
$this->defaultQueryParameters = $defaultQueryParameters; |
74
|
|
|
|
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|