1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the FOSRestBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> |
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
|
|
|
namespace FOS\RestBundle\Controller\Annotations; |
13
|
|
|
|
14
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* View annotation class. |
18
|
|
|
* |
19
|
|
|
* @Annotation |
20
|
|
|
* @Target({"METHOD","CLASS"}) |
21
|
|
|
*/ |
22
|
|
|
class View extends Template |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
protected $templateVar; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var int |
31
|
|
|
*/ |
32
|
|
|
protected $statusCode; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var array |
36
|
|
|
*/ |
37
|
|
|
protected $serializerGroups; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var bool |
41
|
|
|
*/ |
42
|
|
|
protected $populateDefaultVars = true; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var bool |
46
|
|
|
*/ |
47
|
|
|
protected $serializerEnableMaxDepthChecks; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Returns the annotation alias name. |
51
|
|
|
* |
52
|
|
|
* @return string |
53
|
|
|
* |
54
|
|
|
* @see Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface |
55
|
|
|
*/ |
56
|
4 |
|
public function getAliasName() |
57
|
|
|
{ |
58
|
4 |
|
return 'view'; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Sets the template var name to be used for templating formats. |
63
|
|
|
* |
64
|
|
|
* @param string $templateVar |
65
|
|
|
*/ |
66
|
|
|
public function setTemplateVar($templateVar) |
67
|
|
|
{ |
68
|
|
|
$this->templateVar = $templateVar; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Returns the template var name to be used for templating formats. |
73
|
|
|
* |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
11 |
|
public function getTemplateVar() |
77
|
|
|
{ |
78
|
11 |
|
return $this->templateVar; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param int $statusCode |
83
|
|
|
*/ |
84
|
3 |
|
public function setStatusCode($statusCode) |
85
|
|
|
{ |
86
|
3 |
|
$this->statusCode = $statusCode; |
87
|
3 |
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return int |
91
|
|
|
*/ |
92
|
11 |
|
public function getStatusCode() |
93
|
|
|
{ |
94
|
11 |
|
return $this->statusCode; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param array $serializerGroups |
99
|
|
|
*/ |
100
|
|
|
public function setSerializerGroups($serializerGroups) |
101
|
|
|
{ |
102
|
|
|
$this->serializerGroups = $serializerGroups; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return array |
107
|
|
|
*/ |
108
|
11 |
|
public function getSerializerGroups() |
109
|
|
|
{ |
110
|
11 |
|
return $this->serializerGroups; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param bool $populateDefaultVars |
115
|
|
|
*/ |
116
|
2 |
|
public function setPopulateDefaultVars($populateDefaultVars) |
117
|
|
|
{ |
118
|
2 |
|
$this->populateDefaultVars = (bool) $populateDefaultVars; |
119
|
2 |
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return bool |
123
|
|
|
*/ |
124
|
11 |
|
public function isPopulateDefaultVars() |
125
|
|
|
{ |
126
|
11 |
|
return $this->populateDefaultVars; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @param bool $serializerEnableMaxDepthChecks |
131
|
|
|
*/ |
132
|
2 |
|
public function setSerializerEnableMaxDepthChecks($serializerEnableMaxDepthChecks) |
133
|
|
|
{ |
134
|
2 |
|
$this->serializerEnableMaxDepthChecks = $serializerEnableMaxDepthChecks; |
135
|
2 |
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return bool |
139
|
|
|
*/ |
140
|
11 |
|
public function getSerializerEnableMaxDepthChecks() |
141
|
|
|
{ |
142
|
11 |
|
return $this->serializerEnableMaxDepthChecks; |
143
|
|
|
} |
144
|
|
|
} |
145
|
|
|
|