src/AdminBundle/Entity/Zone.php line 12

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * Zone
  6. */
  7. #[ORM\Table(name: 'ctlf_zone')]
  8. #[ORM\Entity(repositoryClass: \AdminBundle\Repository\ZoneRepository::class)]
  9. class Zone extends BaseEntity
  10. {
  11. /**
  12. * @var integer
  13. */
  14. #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
  15. #[ORM\Id]
  16. #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  17. protected $id;
  18. /**
  19. * @var \AdminBundle\Entity\Area
  20. */
  21. #[ORM\JoinColumn(name: 'zone_start_area', referencedColumnName: 'id')]
  22. #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\Area::class)]
  23. protected $zoneStartArea;
  24. /**
  25. * @var \AdminBundle\Entity\Area
  26. */
  27. #[ORM\JoinColumn(name: 'zone_end_area', referencedColumnName: 'id')]
  28. #[ORM\ManyToOne(targetEntity: \AdminBundle\Entity\Area::class)]
  29. protected $zoneEndArea;
  30. /**
  31. * @var boolean
  32. */
  33. #[ORM\Column(name: 'zone_apply_reverse', type: 'boolean')]
  34. protected $zoneApplyReverse;
  35. public function __toString() {
  36. return $this->getId() ? $this->getZoneStartArea(). ' - '. $this->getZoneEndArea() : 'n\a';
  37. }
  38. /**
  39. * @return int
  40. */
  41. public function getId()
  42. {
  43. return $this->id;
  44. }
  45. /**
  46. * @param int $id
  47. */
  48. public function setId($id)
  49. {
  50. $this->id = $id;
  51. }
  52. /**
  53. * @return Area
  54. */
  55. public function getZoneStartArea()
  56. {
  57. return $this->zoneStartArea;
  58. }
  59. /**
  60. * @param Area $zoneStartArea
  61. */
  62. public function setZoneStartArea($zoneStartArea)
  63. {
  64. $this->zoneStartArea = $zoneStartArea;
  65. }
  66. /**
  67. * @return Area
  68. */
  69. public function getZoneEndArea()
  70. {
  71. return $this->zoneEndArea;
  72. }
  73. /**
  74. * @param Area $zoneEndArea
  75. */
  76. public function setZoneEndArea($zoneEndArea)
  77. {
  78. $this->zoneEndArea = $zoneEndArea;
  79. }
  80. /**
  81. * @return boolean
  82. */
  83. public function isZoneApplyReverse()
  84. {
  85. return $this->zoneApplyReverse;
  86. }
  87. /**
  88. * @param boolean $zoneApplyReverse
  89. */
  90. public function setZoneApplyReverse($zoneApplyReverse)
  91. {
  92. $this->zoneApplyReverse = $zoneApplyReverse;
  93. }
  94. public function getZoneName() {
  95. return $this->zoneStartArea->getAreaName().'-'.$this->zoneEndArea->getAreaName();
  96. }
  97. }