ServicePort.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <?php
  2. namespace FTTHBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JMS\Serializer\Annotation as JMS;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7. * @ORM\Entity
  8. * @ORM\Table(name="service_port",
  9. * uniqueConstraints={
  10. * @ORM\UniqueConstraint(name="sp_unique",
  11. * columns={"olt_id", "number"})
  12. * })
  13. */
  14. class ServicePort{
  15. /**
  16. * @var int
  17. *
  18. * @ORM\Column(name="id", type="integer")
  19. * @ORM\Id
  20. * @ORM\GeneratedValue(strategy="AUTO")
  21. */
  22. private $id;
  23. /**
  24. * @ORM\ManyToOne(targetEntity="\FTTHBundle\Entity\OLT", fetch="EXTRA_LAZY", cascade={"persist"})
  25. * @JMS\MaxDepth(1)
  26. */
  27. protected $olt;
  28. /**
  29. * @var int
  30. *
  31. * @ORM\Column(type="integer", options={"default": "0"})
  32. *
  33. * @Assert\NotNull
  34. */
  35. protected $number = 0;
  36. /**
  37. * @var int
  38. *
  39. * @ORM\Column(type="integer", options={"default": "0"})
  40. *
  41. * @Assert\NotNull
  42. */
  43. protected $gemport= 0;
  44. /**
  45. * @var int
  46. *
  47. * @ORM\Column(type="integer", options={"default": "0"})
  48. *
  49. * @Assert\NotNull
  50. */
  51. protected $vlan = 0;
  52. /** @ORM\Column(type="string") */
  53. private $type;
  54. /**
  55. * @ORM\ManyToOne(targetEntity="\FTTHBundle\Entity\ONU", fetch="EXTRA_LAZY", cascade={"persist", "remove"})
  56. * @ORM\JoinColumn(name="onu_id", referencedColumnName="id", onDelete="CASCADE")
  57. * @JMS\MaxDepth(1)
  58. */
  59. protected $onu;
  60. /**
  61. * Set number
  62. *
  63. * @param integer $number
  64. *
  65. * @return ServicePort
  66. */
  67. public function setNumber($number)
  68. {
  69. $this->number = $number;
  70. return $this;
  71. }
  72. /**
  73. * Get number
  74. *
  75. * @return integer
  76. */
  77. public function getNumber()
  78. {
  79. return $this->number;
  80. }
  81. /**
  82. * Set type
  83. *
  84. * @param string $type
  85. *
  86. * @return ServicePort
  87. */
  88. public function setType($type)
  89. {
  90. $this->type = $type;
  91. return $this;
  92. }
  93. /**
  94. * Get type
  95. *
  96. * @return string
  97. */
  98. public function getType()
  99. {
  100. return $this->type;
  101. }
  102. /**
  103. * Set olt
  104. *
  105. * @param \FTTHBundle\Entity\OLT $olt
  106. *
  107. * @return ServicePort
  108. */
  109. public function setOlt(\FTTHBundle\Entity\OLT $olt = null)
  110. {
  111. $this->olt = $olt;
  112. return $this;
  113. }
  114. /**
  115. * Get olt
  116. *
  117. * @return \FTTHBundle\Entity\OLT
  118. */
  119. public function getOlt()
  120. {
  121. return $this->olt;
  122. }
  123. /**
  124. * Set onu
  125. *
  126. * @param \FTTHBundle\Entity\ONU $onu
  127. *
  128. * @return ServicePort
  129. */
  130. public function setOnu(\FTTHBundle\Entity\ONU $onu = null)
  131. {
  132. $this->onu = $onu;
  133. return $this;
  134. }
  135. /**
  136. * Get onu
  137. *
  138. * @return \FTTHBundle\Entity\ONU
  139. */
  140. public function getOnu()
  141. {
  142. return $this->onu;
  143. }
  144. /**
  145. * Get id
  146. *
  147. * @return integer
  148. */
  149. public function getId()
  150. {
  151. return $this->id;
  152. }
  153. public function __toString(){
  154. return (string)$this->number;
  155. }
  156. /**
  157. * Set gemport
  158. *
  159. * @param integer $gemport
  160. *
  161. * @return ServicePort
  162. */
  163. public function setGemport($gemport)
  164. {
  165. $this->gemport = $gemport;
  166. return $this;
  167. }
  168. /**
  169. * Get gemport
  170. *
  171. * @return integer
  172. */
  173. public function getGemport()
  174. {
  175. return $this->gemport;
  176. }
  177. /**
  178. * Set vlan
  179. *
  180. * @param integer $vlan
  181. *
  182. * @return ServicePort
  183. */
  184. public function setVlan($vlan)
  185. {
  186. $this->vlan = $vlan;
  187. return $this;
  188. }
  189. /**
  190. * Get vlan
  191. *
  192. * @return integer
  193. */
  194. public function getVlan()
  195. {
  196. return $this->vlan;
  197. }
  198. }