Department.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. namespace AppBundle\Entity\Core;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Dunglas\ApiBundle\Annotation\Iri;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8. * Enum des départements d'un pays
  9. * (Ex: Haute-Savoie in France)
  10. *
  11. * @Iri("http://schema.org/Department")
  12. */
  13. #[ORM\Entity]
  14. class Department
  15. {
  16. /**
  17. * @var int
  18. */
  19. #[ORM\Column(type: 'integer')]
  20. #[ORM\Id]
  21. #[ORM\GeneratedValue(strategy: 'AUTO')]
  22. #[Groups(['department'])]
  23. private $id;
  24. /**
  25. * @var string The name of the item.
  26. *
  27. * @Iri("https://schema.org/name")
  28. */
  29. #[ORM\Column(type: 'string')]
  30. #[Assert\Type(type: 'string')]
  31. #[Assert\NotNull]
  32. #[Groups(['department'])]
  33. private $name;
  34. /**
  35. * @var string
  36. */
  37. #[ORM\Column(type: 'string', length: 20)]
  38. #[Assert\Type(type: 'string')]
  39. #[Assert\NotNull]
  40. #[Groups(['department'])]
  41. private $departmentNumber;
  42. /**
  43. * @var Region
  44. */
  45. #[ORM\ManyToOne(targetEntity: 'Region')]
  46. #[ORM\JoinColumn(nullable: false)]
  47. #[Groups(['department'])]
  48. private $region;
  49. /**
  50. * Sets id.
  51. *
  52. * @param int $id
  53. *
  54. * @return $this
  55. */
  56. public function setId($id)
  57. {
  58. $this->id = $id;
  59. return $this;
  60. }
  61. /**
  62. * Gets id.
  63. *
  64. * @return int
  65. */
  66. public function getId()
  67. {
  68. return $this->id;
  69. }
  70. /**
  71. * Sets name.
  72. *
  73. * @param string $name
  74. *
  75. * @return $this
  76. */
  77. public function setName($name)
  78. {
  79. $this->name = $name;
  80. return $this;
  81. }
  82. /**
  83. * Gets name.
  84. *
  85. * @return string
  86. */
  87. public function getName()
  88. {
  89. return $this->name;
  90. }
  91. /**
  92. * Sets departmentNumber.
  93. *
  94. * @param string $departmentNumber
  95. *
  96. * @return $this
  97. */
  98. public function setDepartmentNumber($departmentNumber)
  99. {
  100. $this->departmentNumber = $departmentNumber;
  101. return $this;
  102. }
  103. /**
  104. * Gets departmentNumber.
  105. *
  106. * @return string
  107. */
  108. public function getDepartmentNumber()
  109. {
  110. return $this->departmentNumber;
  111. }
  112. /**
  113. * Sets region.
  114. *
  115. * @param Region $region
  116. *
  117. * @return $this
  118. */
  119. public function setRegion(Region $region = null)
  120. {
  121. $this->region = $region;
  122. return $this;
  123. }
  124. /**
  125. * Gets region.
  126. *
  127. * @return Region
  128. */
  129. public function getRegion()
  130. {
  131. return $this->region;
  132. }
  133. }