Settings.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Organization;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Repository\Organization\SettingsRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9. * Caractéristiques d'une Organization (produits, options...etc)
  10. */
  11. #[ApiResource]
  12. #[ORM\Entity(repositoryClass: SettingsRepository::class)]
  13. class Settings
  14. {
  15. #[ORM\Id]
  16. #[ORM\Column]
  17. #[ORM\GeneratedValue]
  18. private ?int $id = null;
  19. #[ORM\OneToOne(inversedBy: 'settings', cascade: ['persist', 'remove'])]
  20. #[ORM\JoinColumn(nullable: false)]
  21. private ?Organization $organization = null;
  22. #[ORM\Column(length: 255)]
  23. #[Assert\Choice(callback: ['\App\Enum\Organization\SettingsProductEnum', 'toArray'], message: 'invalid-product')]
  24. private string $product;
  25. #[ORM\Column(type: 'json', length: 4294967295, nullable: true)]
  26. private ?array $modules = [];
  27. #[ORM\Column(type: 'json', length: 4294967295, nullable: true)]
  28. private ?array $actions = [];
  29. #[ORM\Column(length: 255, options: ['default' => 'FRANCE'])]
  30. private string $country;
  31. public function getId(): ?int
  32. {
  33. return $this->id;
  34. }
  35. public function getOrganization(): ?Organization
  36. {
  37. return $this->organization;
  38. }
  39. public function setOrganization(Organization $organization): self
  40. {
  41. $this->organization = $organization;
  42. return $this;
  43. }
  44. public function getProduct(): string
  45. {
  46. return $this->product;
  47. }
  48. public function setProduct(string $product): self
  49. {
  50. $this->product = $product;
  51. return $this;
  52. }
  53. public function getModules(): ?array
  54. {
  55. return $this->modules;
  56. }
  57. public function setModules(?array $modules): self
  58. {
  59. $this->modules = $modules;
  60. return $this;
  61. }
  62. public function getActions(): ?array
  63. {
  64. return $this->actions;
  65. }
  66. public function setActions(?array $actions): self
  67. {
  68. $this->actions = $actions;
  69. return $this;
  70. }
  71. public function getCountry(): string
  72. {
  73. return $this->country;
  74. }
  75. public function setCountry(string $country): self
  76. {
  77. $this->country = $country;
  78. return $this;
  79. }
  80. }