Settings.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <?php
  2. namespace AppBundle\Entity\Organization;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Dunglas\ApiBundle\Annotation\Iri;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use AppBundle\Entity\Traits\TimestampableEntity;
  9. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  10. /**
  11. * Caractéristiques d'une Organization
  12. * (produits, options...etc)
  13. *
  14. * @Iri("http://schema.org/Settings")
  15. */
  16. #[ORM\Entity]
  17. class Settings
  18. {
  19. use TimestampableEntity;
  20. use CreatorUpdaterEntity;
  21. /**
  22. * @var int
  23. */
  24. #[ORM\Column(type: 'integer')]
  25. #[ORM\Id]
  26. #[ORM\GeneratedValue(strategy: 'AUTO')]
  27. #[Groups(['settings', 'organization_params_list'])]
  28. private $id;
  29. /**
  30. * @var Organization
  31. */
  32. #[ORM\OneToOne(targetEntity: 'Organization', inversedBy: 'settings', fetch: 'EAGER')]
  33. #[ORM\JoinColumn(nullable: false)]
  34. #[Assert\NotNull]
  35. #[Groups(['settings'])]
  36. private $organization;
  37. /**
  38. * @var string
  39. */
  40. #[ORM\Column(type: 'string', nullable: false, options: ['default' => 'school'])]
  41. #[Assert\Type(type: 'string')]
  42. #[Assert\Choice(callback: ['\AppBundle\Enum\Organization\SettingCountryEnum', 'toArray'], message: 'invalid-choice')]
  43. #[Groups(['settings', 'organization_params_list_settings'])]
  44. private $product = 'school';
  45. /**
  46. * @var string
  47. */
  48. #[ORM\Column(type: 'json_array', nullable: true)]
  49. #[Groups(['settings', 'organization_params_list_settings'])]
  50. private $modules;
  51. /**
  52. * @var string
  53. */
  54. #[ORM\Column(type: 'json_array', nullable: true)]
  55. #[Groups(['settings'])]
  56. private $actions;
  57. /**
  58. * @var string
  59. */
  60. #[ORM\Column(type: 'string', nullable: true, options: ['default' => 'FRANCE'])]
  61. #[Assert\Type(type: 'string')]
  62. #[Assert\Choice(callback: ['\AppBundle\Enum\Organization\SettingCountryEnum', 'toArray'], message: 'invalid-choice')]
  63. #[Groups(['settings'])]
  64. private $country = 'FRANCE';
  65. /**
  66. * Sets id.
  67. *
  68. * @param int $id
  69. *
  70. * @return $this
  71. */
  72. public function setId($id)
  73. {
  74. $this->id = $id;
  75. return $this;
  76. }
  77. /**
  78. * Gets id.
  79. *
  80. * @return int
  81. */
  82. public function getId()
  83. {
  84. return $this->id;
  85. }
  86. /**
  87. * Sets organization.
  88. *
  89. * @param Organization $organization
  90. *
  91. * @return $this
  92. */
  93. public function setOrganization(Organization $organization)
  94. {
  95. $this->organization = $organization;
  96. return $this;
  97. }
  98. /**
  99. * Gets organization.
  100. *
  101. * @return Organization
  102. */
  103. public function getOrganization()
  104. {
  105. return $this->organization;
  106. }
  107. /**
  108. * Sets product.
  109. *
  110. * @param string $product
  111. *
  112. * @return $this
  113. */
  114. public function setProduct($product)
  115. {
  116. $this->product = $product;
  117. return $this;
  118. }
  119. /**
  120. * Gets product.
  121. *
  122. * @return string
  123. */
  124. public function getProduct()
  125. {
  126. return $this->product;
  127. }
  128. /**
  129. * Sets modules.
  130. *
  131. * @param array $modules
  132. *
  133. * @return $this
  134. */
  135. public function setModules(array $modules)
  136. {
  137. $this->modules = $modules;
  138. return $this;
  139. }
  140. /**
  141. * Gets modules.
  142. *
  143. * @return array
  144. */
  145. public function getModules()
  146. {
  147. return $this->modules;
  148. }
  149. /**
  150. * Sets actions.
  151. *
  152. * @param array $actions
  153. *
  154. * @return $this
  155. */
  156. public function setActions(array $actions)
  157. {
  158. $this->actions = $actions;
  159. return $this;
  160. }
  161. /**
  162. * Gets actions.
  163. *
  164. * @return array
  165. */
  166. public function getActions()
  167. {
  168. return $this->actions;
  169. }
  170. /**
  171. * Set country
  172. *
  173. * @param string $country
  174. *
  175. * @return Settings
  176. */
  177. public function setCountry($country)
  178. {
  179. $this->country = $country;
  180. return $this;
  181. }
  182. /**
  183. * Get country
  184. *
  185. * @return string
  186. */
  187. public function getCountry()
  188. {
  189. return $this->country;
  190. }
  191. }