src/Entity/Address.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\SuperClass\BaseEntity;
  4. use App\Repository\AddressRepository;
  5. use App\Validator\IsValidOwner;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10. * @ORM\Entity(repositoryClass=AddressRepository::class)
  11. */
  12. class Address extends BaseEntity
  13. {
  14. /**
  15. * @ORM\Column(type="string", length=255)
  16. */
  17. private $city;
  18. /**
  19. * @ORM\Column(type="string", length=255)
  20. */
  21. private $country;
  22. /**
  23. * @ORM\Column(type="string", length=255)
  24. */
  25. private $line1;
  26. /**
  27. * @ORM\Column(type="string", length=255 , nullable="true")
  28. */
  29. private $line2;
  30. /**
  31. * @ORM\Column(type="string", length=255)
  32. */
  33. private $postal_code;
  34. /**
  35. * @ORM\Column(type="string", length=255)
  36. */
  37. private $state;
  38. /**
  39. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="addresses")
  40. * @ORM\JoinColumn(nullable=false)
  41. * @IsValidOwner()
  42. */
  43. protected ?User $owner;
  44. /**
  45. * @ORM\Column(type="address_type")
  46. */
  47. private $type;
  48. public function __construct()
  49. {
  50. $this->type = new ArrayCollection();
  51. }
  52. public function getId(): ?int
  53. {
  54. return $this->id;
  55. }
  56. public function getCity(): ?string
  57. {
  58. return $this->city;
  59. }
  60. public function setCity(string $city): self
  61. {
  62. $this->city = $city;
  63. return $this;
  64. }
  65. public function getCountry(): ?string
  66. {
  67. return $this->country;
  68. }
  69. public function setCountry(string $country): self
  70. {
  71. $this->country = $country;
  72. return $this;
  73. }
  74. public function getLine1(): ?string
  75. {
  76. return $this->line1;
  77. }
  78. public function setLine1(string $line1): self
  79. {
  80. $this->line1 = $line1;
  81. return $this;
  82. }
  83. public function getLine2(): ?string
  84. {
  85. return $this->line2;
  86. }
  87. public function setLine2(?string $line2): self
  88. {
  89. $this->line2 = $line2;
  90. return $this;
  91. }
  92. public function getPostalCode(): ?string
  93. {
  94. return $this->postal_code;
  95. }
  96. public function setPostalCode(string $postal_code): self
  97. {
  98. $this->postal_code = $postal_code;
  99. return $this;
  100. }
  101. public function getState(): ?string
  102. {
  103. return $this->state;
  104. }
  105. public function setState(string $state): self
  106. {
  107. $this->state = $state;
  108. return $this;
  109. }
  110. public function getOwner(): ?User
  111. {
  112. return $this->owner;
  113. }
  114. public function setOwner(?User $owner): self
  115. {
  116. $this->owner = $owner;
  117. return $this;
  118. }
  119. public function getType()
  120. {
  121. return $this->type;
  122. }
  123. public function setType($type): self
  124. {
  125. $this->type = $type;
  126. return $this;
  127. }
  128. }