src/Entity/Declaration/Product.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Declaration;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use ApiPlatform\Core\Annotation\ApiSubresource;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10. * @ORM\Entity
  11. * @ORM\Table(name="brunex_declaration_product")
  12. * @ApiResource(
  13. * routePrefix="/brunex/declaration",
  14. * normalizationContext={"groups"={"product:list"}},
  15. * )
  16. */
  17. class Product
  18. {
  19. /**
  20. * @var int
  21. * @ORM\Id
  22. * @ORM\GeneratedValue
  23. * @ORM\Column(type="integer")
  24. * @Groups({"product", "product:list", "declaration", "declaration:list"})
  25. */
  26. protected $id;
  27. /**
  28. * @var string
  29. * @ORM\Column(type="text")
  30. * @Groups({"product", "product:list", "declaration", "declaration:list"})
  31. */
  32. protected $name;
  33. /**
  34. * @var Collection<Definition>
  35. * @ORM\OneToMany(targetEntity="Definition", mappedBy="product", cascade={"persist"})
  36. * @Groups({"product", "declaration"})
  37. * @ApiSubresource
  38. */
  39. protected $definitions;
  40. /**
  41. * @var Collection<Declaration>
  42. * @ORM\OneToMany(targetEntity="Declaration", mappedBy="product")
  43. * @Groups({"product", "declaration"})
  44. */
  45. protected $declarations;
  46. /**
  47. * @var Collection<DetailDocument>
  48. * @ORM\OneToMany(targetEntity="DetailDocument", mappedBy="product")
  49. * @Groups({"product", "declaration"})
  50. */
  51. protected $detailDocuments;
  52. /**
  53. * @var Collection<EvidenceDocument>
  54. * @ORM\OneToMany(targetEntity="EvidenceDocument", mappedBy="product")
  55. * @Groups({"product", "declaration"})
  56. */
  57. protected $evidenceDocuments;
  58. /**
  59. * @var Collection<RegulationDocument>
  60. * @ORM\OneToMany(targetEntity="RegulationDocument", mappedBy="product")
  61. * @Groups({"product", "declaration"})
  62. */
  63. protected $regulationDocuments;
  64. /**
  65. * @var Collection<Attachment>
  66. * @ORM\OneToMany(targetEntity="Attachment", mappedBy="product")
  67. * @Groups({"product", "declaration"})
  68. */
  69. protected $attachments;
  70. /**
  71. * @var int
  72. * @ORM\Column(type="integer")
  73. */
  74. protected $position = 9999;
  75. public function __construct()
  76. {
  77. $this->definitions = new \Doctrine\Common\Collections\ArrayCollection();
  78. $this->declarations = new \Doctrine\Common\Collections\ArrayCollection();
  79. $this->detailDocuments = new ArrayCollection();
  80. $this->evidenceDocuments = new ArrayCollection();
  81. $this->regulationDocuments = new ArrayCollection();
  82. $this->attachments = new ArrayCollection();
  83. }
  84. public function __toString() {
  85. return $this->name;
  86. }
  87. /**
  88. * @return int
  89. */
  90. public function getId()
  91. {
  92. return $this->id;
  93. }
  94. /**
  95. * @return string
  96. */
  97. public function getName()
  98. {
  99. return $this->name;
  100. }
  101. /**
  102. * @param string $name
  103. *
  104. * @return Product
  105. */
  106. public function setName($name)
  107. {
  108. $this->name = $name;
  109. return $this;
  110. }
  111. /**
  112. * @return Collection
  113. */
  114. public function getDefinitions()
  115. {
  116. return $this->definitions;
  117. }
  118. /**
  119. * @param Collection $definitions
  120. *
  121. * @return Product
  122. */
  123. public function setDefinitions($definitions)
  124. {
  125. $this->definitions = $definitions;
  126. return $this;
  127. }
  128. /**
  129. * @return Collection
  130. */
  131. public function getDeclarations()
  132. {
  133. return $this->declarations;
  134. }
  135. /**
  136. * @param Collection $declarations
  137. *
  138. * @return Product
  139. */
  140. public function setDeclarations($declarations)
  141. {
  142. $this->declarations = $declarations;
  143. return $this;
  144. }
  145. /**
  146. * @return Collection
  147. */
  148. public function getDetailDocuments()
  149. {
  150. return $this->detailDocuments;
  151. }
  152. /**
  153. * @param Collection $detailDocuments
  154. *
  155. * @return Product
  156. */
  157. public function setDetailDocuments($detailDocuments)
  158. {
  159. $this->detailDocuments = $detailDocuments;
  160. return $this;
  161. }
  162. /**
  163. * @return Collection
  164. */
  165. public function getEvidenceDocuments()
  166. {
  167. return $this->evidenceDocuments;
  168. }
  169. /**
  170. * @param Collection $evidenceDocuments
  171. *
  172. * @return Product
  173. */
  174. public function setEvidenceDocuments($evidenceDocuments)
  175. {
  176. $this->evidenceDocuments = $evidenceDocuments;
  177. return $this;
  178. }
  179. /**
  180. * @return Collection
  181. */
  182. public function getRegulationDocuments()
  183. {
  184. return $this->regulationDocuments;
  185. }
  186. /**
  187. * @param Collection $regulationDocuments
  188. *
  189. * @return Product
  190. */
  191. public function setRegulationDocuments($regulationDocuments)
  192. {
  193. $this->regulationDocuments = $regulationDocuments;
  194. return $this;
  195. }
  196. /**
  197. * @return Collection
  198. */
  199. public function getAttachments(): Collection
  200. {
  201. return $this->attachments;
  202. }
  203. /**
  204. * @param Collection $attachments
  205. *
  206. * @return Product
  207. */
  208. public function setAttachments(Collection $attachments): Product
  209. {
  210. $this->attachments = $attachments;
  211. return $this;
  212. }
  213. /**
  214. * @return int
  215. */
  216. public function getPosition()
  217. {
  218. return $this->position;
  219. }
  220. /**
  221. * @param int $position
  222. *
  223. * @return Product
  224. */
  225. public function setPosition($position)
  226. {
  227. $this->position = $position;
  228. return $this;
  229. }
  230. }