Region.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. * Region d'un pays
  9. * (Ex: Alsace in France).
  10. *
  11. * @Iri("http://schema.org/Region")
  12. */
  13. #[ORM\Entity]
  14. class Region
  15. {
  16. /**
  17. * @var int
  18. */
  19. #[ORM\Column(type: 'integer')]
  20. #[ORM\Id]
  21. #[ORM\GeneratedValue(strategy: 'AUTO')]
  22. #[Groups(['region'])]
  23. private $id;
  24. /**
  25. * @var string
  26. */
  27. #[ORM\Column(type: 'string', nullable: true)]
  28. #[Assert\Type(type: 'string')]
  29. #[Groups(['region'])]
  30. private $name;
  31. /**
  32. * @var Country
  33. */
  34. #[ORM\ManyToOne(targetEntity: 'Country')]
  35. #[ORM\JoinColumn(nullable: false)]
  36. #[Groups(['region'])]
  37. private $country;
  38. /**
  39. * Sets id.
  40. *
  41. * @param int $id
  42. *
  43. * @return $this
  44. */
  45. public function setId($id)
  46. {
  47. $this->id = $id;
  48. return $this;
  49. }
  50. /**
  51. * Gets id.
  52. *
  53. * @return int
  54. */
  55. public function getId()
  56. {
  57. return $this->id;
  58. }
  59. /**
  60. * Sets name.
  61. *
  62. * @param string $name
  63. *
  64. * @return $this
  65. */
  66. public function setName($name)
  67. {
  68. $this->name = $name;
  69. return $this;
  70. }
  71. /**
  72. * Gets name.
  73. *
  74. * @return string
  75. */
  76. public function getName()
  77. {
  78. return $this->name;
  79. }
  80. /**
  81. * Sets country.
  82. *
  83. * @param Country $country
  84. *
  85. * @return $this
  86. */
  87. public function setCountry(Country $country = null)
  88. {
  89. $this->country = $country;
  90. return $this;
  91. }
  92. /**
  93. * Gets country.
  94. *
  95. * @return Country
  96. */
  97. public function getCountry()
  98. {
  99. return $this->country;
  100. }
  101. }