src/App/Entity/RecurrentJobAdditionalZipcode.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Validator\Constraint as AppAssert;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity
  7. *
  8. * @ORM\Table(
  9. * name="recurrent_job_additional_zipcodes",
  10. * uniqueConstraints={@ORM\UniqueConstraint(name="recurrent_jobs_id_zipcode_idx", columns={"recurrent_jobs_id", "zipcode"})}
  11. * )
  12. */
  13. class RecurrentJobAdditionalZipcode
  14. {
  15. public function __construct(RecurrentJob $recurrentJob, string $zipcode)
  16. {
  17. $this->recurrentJob = $recurrentJob;
  18. $this->zipcode = $zipcode;
  19. }
  20. /**
  21. * @var RecurrentJob
  22. *
  23. * @ORM\Id
  24. *
  25. * @ORM\ManyToOne(targetEntity="App\Entity\RecurrentJob", inversedBy="additionalZipcodes", cascade={"persist"})
  26. *
  27. * @ORM\JoinColumn(name="recurrent_jobs_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  28. */
  29. private $recurrentJob;
  30. /**
  31. * @var string
  32. *
  33. * @ORM\Id
  34. *
  35. * @ORM\Column(name="zipcode", type="string", length=128, nullable=false)
  36. *
  37. * @AppAssert\KnownZipcode
  38. */
  39. private $zipcode;
  40. public function getZipcode(): string
  41. {
  42. return $this->zipcode;
  43. }
  44. }