src/Entity/Declaration/Field.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Declaration;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8. * @ORM\Entity(repositoryClass="App\Repository\Declaration\FieldRepository")
  9. * @ORM\Table(name="brunex_declaration_field")
  10. * @ApiResource(routePrefix="/brunex/declaration", attributes={"order"={"position": "ASC"}})
  11. * @ORM\HasLifecycleCallbacks()
  12. */
  13. class Field
  14. {
  15. const TYPE_TEXT = 'text';
  16. const TYPE_SELECT = 'select';
  17. const TYPE_FIXED = 'fixed';
  18. const TYPE_CHECKBOX = 'checkbox';
  19. /**
  20. * @var int
  21. * @ORM\Id
  22. * @ORM\GeneratedValue
  23. * @ORM\Column(type="integer")
  24. * @Groups({"product", "declaration", "definition"})
  25. */
  26. protected $id;
  27. /**
  28. * @var string
  29. * @ORM\Column(type="text")
  30. * @Groups({"product", "declaration", "definition"})
  31. * @Gedmo\Translatable
  32. */
  33. protected $name = '';
  34. /**
  35. * @var string
  36. * @ORM\Column(type="text")
  37. * @Groups({"product", "declaration", "definition"})
  38. */
  39. protected $type = '';
  40. /**
  41. * @var bool
  42. * @ORM\Column(type="boolean")
  43. */
  44. protected $isSorted = false;
  45. /**
  46. * @var array
  47. * @ORM\Column(type="array")
  48. * @Groups({"product", "declaration", "definition"})
  49. */
  50. protected $valueList = [];
  51. /**
  52. * @var int
  53. * @ORM\Column(type="integer")
  54. * @Groups({"product", "declaration", "definition"})
  55. */
  56. protected $position = 9999;
  57. /**
  58. * @var bool
  59. * @ORM\Column(type="boolean")
  60. * @Groups({"product", "declaration", "definition"})
  61. */
  62. protected $isRequired = false;
  63. /**
  64. * @var bool
  65. * @ORM\Column(type="boolean")
  66. * @Groups({"product", "declaration", "definition"})
  67. */
  68. protected $isOptional = false;
  69. /**
  70. * @var bool
  71. * @ORM\Column(type="boolean")
  72. * @Groups({"product", "declaration", "definition"})
  73. */
  74. protected $isHidden = false;
  75. /**
  76. * @var bool
  77. * @ORM\Column(type="boolean")
  78. * @Groups({"product", "declaration", "definition"})
  79. */
  80. protected $exap = false;
  81. /**
  82. * @var string
  83. * @ORM\Column(type="text")
  84. * @Groups({"product", "declaration", "definition"})
  85. */
  86. protected $notifiedBody = '';
  87. /**
  88. * @var string
  89. * @ORM\Column(type="text")
  90. * @Groups({"product", "declaration", "definition"})
  91. */
  92. protected $variableName = '';
  93. /**
  94. * @var string
  95. * @ORM\Column(type="text")
  96. * @Groups({"product", "declaration", "definition"})
  97. */
  98. protected $variablePrefix = '';
  99. /**
  100. * @var string
  101. * @ORM\Column(type="text")
  102. * @Groups({"product", "declaration", "definition"})
  103. */
  104. protected $variableSuffix = '';
  105. /**
  106. * @var string
  107. * @ORM\Column(type="text")
  108. * @Groups({"product", "declaration", "definition"})
  109. */
  110. protected $variableValue = '';
  111. public function __toString()
  112. {
  113. return $this->name;
  114. }
  115. /**
  116. * @return int
  117. */
  118. public function getId()
  119. {
  120. return $this->id;
  121. }
  122. /**
  123. * @return string
  124. */
  125. public function getName()
  126. {
  127. return $this->name;
  128. }
  129. /**
  130. * @param string $name
  131. *
  132. * @return Field
  133. */
  134. public function setName($name)
  135. {
  136. $this->name = $name;
  137. return $this;
  138. }
  139. /**
  140. * @return string
  141. */
  142. public function getType()
  143. {
  144. return $this->type;
  145. }
  146. /**
  147. * @param string $type
  148. *
  149. * @return Field
  150. */
  151. public function setType($type)
  152. {
  153. $this->type = $type;
  154. return $this;
  155. }
  156. /**
  157. * @return bool
  158. */
  159. public function isSorted()
  160. {
  161. return $this->isSorted;
  162. }
  163. /**
  164. * @param bool $isSorted
  165. *
  166. * @return Field
  167. */
  168. public function setIsSorted($isSorted)
  169. {
  170. $this->isSorted = $isSorted;
  171. return $this;
  172. }
  173. /**
  174. * @return array
  175. */
  176. public function getValueList()
  177. {
  178. return $this->valueList;
  179. }
  180. /**
  181. * @param array $valueList
  182. *
  183. * @return Field
  184. */
  185. public function setValueList(array $valueList)
  186. {
  187. $this->valueList = $valueList;
  188. return $this;
  189. }
  190. /**
  191. * @return int
  192. */
  193. public function getPosition()
  194. {
  195. return $this->position;
  196. }
  197. /**
  198. * @param int $position
  199. *
  200. * @return Field
  201. */
  202. public function setPosition($position)
  203. {
  204. $this->position = $position;
  205. return $this;
  206. }
  207. /**
  208. * @return bool
  209. */
  210. public function isRequired()
  211. {
  212. return $this->isRequired;
  213. }
  214. /**
  215. * @param bool $isRequired
  216. *
  217. * @return Field
  218. */
  219. public function setIsRequired($isRequired)
  220. {
  221. $this->isRequired = $isRequired;
  222. return $this;
  223. }
  224. /**
  225. * @return bool
  226. */
  227. public function isOptional()
  228. {
  229. return $this->isOptional;
  230. }
  231. /**
  232. * @param bool $isOptional
  233. *
  234. * @return Field
  235. */
  236. public function setIsOptional($isOptional)
  237. {
  238. $this->isOptional = $isOptional;
  239. return $this;
  240. }
  241. /**
  242. * @return bool
  243. */
  244. public function isHidden()
  245. {
  246. return $this->isHidden;
  247. }
  248. /**
  249. * @param bool $isHidden
  250. *
  251. * @return Field
  252. */
  253. public function setIsHidden($isHidden)
  254. {
  255. $this->isHidden = $isHidden;
  256. return $this;
  257. }
  258. /**
  259. * @return string
  260. */
  261. public function getNotifiedBody()
  262. {
  263. return $this->notifiedBody;
  264. }
  265. /**
  266. * @param string $notifiedBody
  267. *
  268. * @return Field
  269. */
  270. public function setNotifiedBody($notifiedBody)
  271. {
  272. $this->notifiedBody = $notifiedBody;
  273. return $this;
  274. }
  275. /**
  276. * @return string
  277. */
  278. public function getVariableName(): string
  279. {
  280. return $this->variableName;
  281. }
  282. /**
  283. * @param string $variableName
  284. *
  285. * @return Field
  286. */
  287. public function setVariableName(string $variableName): Field
  288. {
  289. $this->variableName = $variableName;
  290. return $this;
  291. }
  292. /**
  293. * @return bool
  294. */
  295. public function isExap(): bool
  296. {
  297. return $this->exap;
  298. }
  299. /**
  300. * @param bool $exap
  301. */
  302. public function setExap(bool $exap): void
  303. {
  304. $this->exap = $exap;
  305. }
  306. /**
  307. * @return string
  308. */
  309. public function getVariableValue(): string
  310. {
  311. return $this->variableValue;
  312. }
  313. /**
  314. * @param string $variableValue
  315. */
  316. public function setVariableValue(string $variableValue): void
  317. {
  318. $this->variableValue = $variableValue;
  319. }
  320. /**
  321. * @return string
  322. */
  323. public function getVariablePrefix(): string
  324. {
  325. return $this->variablePrefix;
  326. }
  327. /**
  328. * @param string $variablePrefix
  329. */
  330. public function setVariablePrefix(string $variablePrefix): void
  331. {
  332. $this->variablePrefix = $variablePrefix;
  333. }
  334. /**
  335. * @return string
  336. */
  337. public function getVariableSuffix(): string
  338. {
  339. return $this->variableSuffix;
  340. }
  341. /**
  342. * @param string $variableSuffix
  343. */
  344. public function setVariableSuffix(string $variableSuffix): void
  345. {
  346. $this->variableSuffix = $variableSuffix;
  347. }
  348. }