123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463 |
- <?php
- namespace StatsBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- use Base\AdminBundle\Traits\TenancyIdTrait;
- use Base\AdminBundle\Traits\TenancyIdTraitInterface;
- /**
- * @ORM\Table
- * @ORM\Entity
- * @UniqueEntity(fields={"deviceServer", "oltDeviceId", "ponPort"}, message="errors.duplicate_key")
- * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"device_server_id", "olt_device_id", "pon_port"})})
- */
- class PonPort implements TenancyIdTraitInterface
- {
- use TenancyIdTrait;
- /**
- * @var int
- *
- * @ORM\Column(name="id", type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- private $ponPort;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $oltDeviceId;
- /**
- * @ORM\ManyToOne(targetEntity="DeviceServer", inversedBy="devices", fetch="EXTRA_LAZY")
- */
- protected $deviceServer;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $updated;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $txPower;
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- public $rxPower;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $voltage;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $temperature;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $biasCurrent;
- /**
- * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true)
- */
- public $inOctets;
- /**
- * @ORM\Column(type="decimal", precision=16, scale=3, nullable=true)
- */
- public $outOctets;
-
- /**
- * @ORM\Column(type="integer", nullable=true)
- */
- public $online;
-
- /**
- * @ORM\Column(type="integer", nullable=true)
- */
- public $offline;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $index;
- /**
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @return string
- */
- public function __toString()
- {
- return sprintf('%s', strtoupper($this->ponPort));
- }
- /**
- * Set ponPort
- *
- * @param string $ponPort
- *
- * @return PonPort
- */
- public function setPonPort($ponPort)
- {
- $this->ponPort = $ponPort;
- return $this;
- }
- /**
- * Get ponPort
- *
- * @return string
- */
- public function getPonPort()
- {
- return $this->ponPort;
- }
- /**
- * @param int $oltDeviceId
- *
- * @return PonPort
- */
- public function setOltDeviceId($oltDeviceId)
- {
- $this->oltDeviceId = $oltDeviceId;
- return $this;
- }
- /**
- * @return int
- */
- public function getOltDeviceId()
- {
- return $this->oltDeviceId;
- }
- /**
- * @param DeviceServer $deviceServer
- *
- * @return PonPort
- */
- public function setDeviceServer($deviceServer)
- {
- $this->deviceServer = $deviceServer;
- return $this;
- }
- /**
- * @return DeviceServer
- */
- public function getDeviceServer()
- {
- return $this->deviceServer;
- }
- /**
- * Set updated
- *
- * @param Datetime $updated
- *
- * @return PonPort
- */
- public function setUpdated($updated)
- {
- $this->updated = $updated;
- return $this;
- }
- /**
- * Get updated
- *
- * @return \DateTime
- */
- public function getUpdated()
- {
- return $this->updated;
- }
- /**
- * Set txPower
- *
- * @param decimal $txPower
- * @return PonPort
- */
- public function setTxPower($txPower)
- {
- $this->txPower = $txPower;
- return $this;
- }
- /**
- * Get txPower
- *
- * @return decimal
- */
- public function getTxPower()
- {
- if(is_null($this->txPower)) return null;
- return (float)$this->txPower;
- }
- /**
- * Set rxPower
- *
- * @param string $rxPower
- * @return PonPort
- */
- public function setRxPower($rxPower)
- {
- $this->rxPower = $rxPower;
- return $this;
- }
- /**
- * Get rxPower
- *
- * @return string
- */
- public function getRxPower()
- {
- return $this->rxPower;
- }
- /**
- * Get rxPower
- *
- * @return string
- */
- public function getArrayRxPower()
- {
- if ($this->rxPower) {
- return json_decode($this->rxPower, true);
- }
- return array();
- }
- /**
- * Set voltage
- *
- * @param decimal $voltage
- * @return PonPort
- */
- public function setVoltage($voltage)
- {
- $this->voltage = $voltage;
- return $this;
- }
- /**
- * Get voltage
- *
- * @return decimal
- */
- public function getVoltage()
- {
- if(is_null($this->voltage)) return null;
-
- return (float)$this->voltage;
- }
- /**
- * Set temperature
- *
- * @param decimal $temperature
- * @return PonPort
- */
- public function setTemperature($temperature)
- {
- $this->temperature = $temperature;
- return $this;
- }
- /**
- * Get temperature
- *
- * @return decimal
- */
- public function getTemperature()
- {
- if(is_null($this->temperature)) return null;
-
- return (float)$this->temperature;
- }
- /**
- * Set biasCurrent
- *
- * @param decimal $biasCurrent
- * @return PonPort
- */
- public function setBiasCurrent($biasCurrent)
- {
- $this->biasCurrent = $biasCurrent;
- return $this;
- }
- /**
- * Get biasCurrent
- *
- * @return decimal
- */
- public function getBiasCurrent()
- {
- if(is_null($this->biasCurrent)) return null;
-
- return (float)$this->biasCurrent;
- }
- /**
- * Set inOctets
- *
- * @param string $inOctets
- *
- * @return PonPort
- */
- public function setInOctets($inOctets)
- {
- $this->inOctets = $inOctets;
- return $this;
- }
- /**
- * Get inOctets
- *
- * @return string
- */
- public function getInOctets()
- {
- return (float) $this->inOctets;
- }
- /**
- * Set outOctets
- *
- * @param string $outOctets
- *
- * @return PonPort
- */
- public function setOutOctets($outOctets)
- {
- $this->outOctets = $outOctets;
- return $this;
- }
- /**
- * Get outOctets
- *
- * @return string
- */
- public function getOutOctets()
- {
- return (float) $this->outOctets;
- }
- /**
- * Set online
- *
- * @param integer $online
- *
- * @return PonPort
- */
- public function setOnline($online)
- {
- $this->online = $online;
- return $this;
- }
- /**
- * Get online
- *
- * @return integer
- */
- public function getOnline()
- {
- return $this->online;
- }
- /**
- * Set offline
- *
- * @param integer $offline
- *
- * @return PonPort
- */
- public function setOffline($offline)
- {
- $this->offline = $offline;
- return $this;
- }
- /**
- * Get offline
- *
- * @return integer
- */
- public function getOffline()
- {
- return $this->offline;
- }
- /**
- * Set index
- *
- * @param integer $index
- *
- * @return PonPort
- */
- public function setIndex($index)
- {
- $this->index = $index;
- return $this;
- }
- /**
- * Get index
- *
- * @return integer
- */
- public function getIndex()
- {
- return $this->index;
- }
- }
|