src/Entity/Address.php line 104

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8. * @ORM\Entity
  9. * @ApiResource(iri = "http://schema.org/Thing", collectionOperations = {
  10. "get" = {
  11. "method" = "GET",
  12. "normalization_context" = {
  13. "groups" = {
  14. "output"
  15. }
  16. },
  17. "denormalization_context" = {
  18. "groups" = {
  19. "input"
  20. }
  21. }
  22. },
  23. "post" = {
  24. "access_control" = "is_granted('ROLE_USER')",
  25. "method" = "POST",
  26. "normalization_context" = {
  27. "groups" = {
  28. "output"
  29. }
  30. },
  31. "denormalization_context" = {
  32. "groups" = {
  33. "input"
  34. }
  35. }
  36. }
  37. }, itemOperations = {
  38. "get" = {
  39. "access_control" = "is_granted('IS_OWNER', object) or is_granted('ROLE_ADMIN') or is_granted('ROLE_SUPER_ADMIN')",
  40. "method" = "GET",
  41. "normalization_context" = {
  42. "groups" = {
  43. "output"
  44. }
  45. },
  46. "denormalization_context" = {
  47. "groups" = {
  48. "input"
  49. }
  50. }
  51. },
  52. "put" = {
  53. "access_control" = "is_granted('IS_OWNER', object) or is_granted('ROLE_ADMIN') or is_granted('ROLE_SUPER_ADMIN')",
  54. "method" = "PUT",
  55. "normalization_context" = {
  56. "groups" = {
  57. "output"
  58. }
  59. },
  60. "denormalization_context" = {
  61. "groups" = {
  62. "input"
  63. }
  64. }
  65. },
  66. "delete" = {
  67. "access_control" = "is_granted('IS_OWNER', object)",
  68. "method" = "DELETE",
  69. "normalization_context" = {
  70. "groups" = {
  71. "output"
  72. }
  73. },
  74. "denormalization_context" = {
  75. "groups" = {
  76. "input"
  77. }
  78. }
  79. }
  80. }, attributes = {
  81. "filters" = {
  82. "address.search_filter",
  83. },
  84. "normalization_context" = {
  85. "groups" = {
  86. ""
  87. }
  88. },
  89. "denormalization_context" = {
  90. "groups" = {
  91. ""
  92. }
  93. },
  94. "pagination_items_per_page" = 10,
  95. "pagination_client_items_per_page" = true
  96. }) * The most generic type of item.
  97. *
  98. * @see http://schema.org/Thing Documentation on Schema.org
  99. */
  100. class Address extends AbstractTimestamp
  101. {
  102. /**
  103. * @ORM\Id
  104. * @ORM\GeneratedValue(strategy="AUTO")
  105. * @ORM\Column(type="integer")
  106. * @Groups({"output"})
  107. *
  108. * @var int|null
  109. */
  110. protected $id;
  111. /**
  112. * @ORM\Column(type="string", length=180, nullable=true)
  113. * @Groups({"output", "input"})
  114. *
  115. * @var string|null
  116. */
  117. protected $nickname;
  118. /**
  119. * @ORM\Column(type="string", length=180, nullable=false)
  120. * @Groups({"output", "input"})
  121. *
  122. * @var string|null
  123. */
  124. protected $line1;
  125. /**
  126. * @ORM\Column(type="string", length=180, nullable=true)
  127. * @Groups({"output", "input"})
  128. *
  129. * @var string|null
  130. */
  131. protected $line2;
  132. /**
  133. * @ORM\Column(type="string", length=180, nullable=false)
  134. * @Groups({"output", "input"})
  135. *
  136. * @var string|null
  137. */
  138. protected $city;
  139. /**
  140. * @ORM\Column(type="string", length=10, nullable=false)
  141. * @Groups({"output", "input"})
  142. *
  143. * @var string|null
  144. */
  145. protected $zip;
  146. /**
  147. * @ORM\Column(type="boolean", nullable=true)
  148. * @Groups({"output", "input"})
  149. *
  150. * @var bool|null
  151. */
  152. protected $addressBook;
  153. /**
  154. * @ORM\ManyToOne(targetEntity="App\Entity\Lookup")
  155. * @ORM\JoinColumn(referencedColumnName="id")
  156. * @Groups({"output", "input"})
  157. *
  158. * @var Lookup|null
  159. */
  160. protected $state;
  161. /**
  162. * @ORM\ManyToOne(targetEntity="App\Entity\Lookup")
  163. * @ORM\JoinColumn(referencedColumnName="id")
  164. * @Groups({"output", "input"})
  165. *
  166. * @var Lookup|null
  167. */
  168. protected $county;
  169. public function getId(): ?int
  170. {
  171. return $this->id;
  172. }
  173. public function setNickname(?string $nickname): self
  174. {
  175. $this->nickname = $nickname;
  176. return $this;
  177. }
  178. public function getNickname(): ?string
  179. {
  180. return $this->nickname;
  181. }
  182. public function setLine1(?string $line1): self
  183. {
  184. $this->line1 = $line1;
  185. return $this;
  186. }
  187. public function getLine1(): ?string
  188. {
  189. return $this->line1;
  190. }
  191. public function setLine2(?string $line2): self
  192. {
  193. $this->line2 = $line2;
  194. return $this;
  195. }
  196. public function getLine2(): ?string
  197. {
  198. return $this->line2;
  199. }
  200. public function setCity(?string $city): self
  201. {
  202. $this->city = $city;
  203. return $this;
  204. }
  205. public function getCity(): ?string
  206. {
  207. return $this->city;
  208. }
  209. public function setZip(?string $zip): self
  210. {
  211. $this->zip = $zip;
  212. return $this;
  213. }
  214. public function getZip(): ?string
  215. {
  216. return $this->zip;
  217. }
  218. public function setAddressBook(?bool $addressBook): self
  219. {
  220. $this->addressBook = $addressBook;
  221. return $this;
  222. }
  223. public function getAddressBook(): ?bool
  224. {
  225. return $this->addressBook;
  226. }
  227. public function setState(?Lookup $state): self
  228. {
  229. $this->state = $state;
  230. return $this;
  231. }
  232. public function getState(): ?Lookup
  233. {
  234. return $this->state;
  235. }
  236. public function setCounty(?Lookup $county): self
  237. {
  238. $this->county = $county;
  239. return $this;
  240. }
  241. public function getCounty(): ?Lookup
  242. {
  243. return $this->county;
  244. }
  245. }