123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- <?php
- namespace StatsBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * @ORM\Table
- * @ORM\Entity(repositoryClass="StatsBundle\Repository\OnuRepository")
- * @UniqueEntity(fields={"deviceServer", "oltDeviceId", "ponSerialNumber"}, message="errors.duplicate_key")
- * @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"device_server_id", "olt_device_id", "pon_serial_number"})})
- */
- class Onu
- {
-
- /**
- * @var int
- *
- * @ORM\Column(name="id", type="integer", nullable=false)
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
-
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- private $ponSerialNumber;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $oltDeviceId;
- /**
- * @ORM\ManyToOne(targetEntity="DeviceServer", inversedBy="devices", fetch="EXTRA_LAZY")
- */
- protected $deviceServer;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=true)
- */
- private $deviceId;
- /**
- * @var int
- *
- * @ORM\Column(type="integer", nullable=false, options={"default":1})
- */
- protected $tenancyId = 1;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=255, nullable=true)
- *
- * @Assert\Ip
- */
- private $ip;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=12, nullable=true)
- */
- private $mac;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- private $serialNumber;
- /**
- * @ORM\Column(type="string", length=25, nullable=true)
- */
- private $ponPort;
- /**
- * @ORM\Column(name="status", type="boolean", nullable=true, columnDefinition="BOOLEAN DEFAULT FALSE")
- */
- public $status = false;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, nullable=true)
- */
- public $txPower;
- /**
- * @ORM\Column(type="decimal", precision=6, scale=3, 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="string", length=25, nullable=true)
- */
- public $uptime;
- /**
- * @ORM\Column(type="datetime")
- */
- protected $updated;
- /**
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @return string
- */
- public function getCustomId()
- {
- return sprintf('%s~%s~%s', strtolower($this->ponSerialNumber), $this->oltDeviceId, $this->deviceServer->getId());
- }
- /**
- * @return string
- */
- public function __toString()
- {
- return sprintf('%s', strtoupper($this->ponSerialNumber));
- }
- /**
- * @param string $ip
- *
- * @return Device
- */
- public function setIp($ip = null)
- {
- $this->ip = $ip;
- return $this;
- }
- /**
- * @return string
- */
- public function getIp()
- {
- return $this->ip;
- }
- /**
- * Set mac
- *
- * @param string $mac
- *
- * @return ONU
- */
- public function setMac($mac)
- {
- $this->mac = $mac;
- return $this;
- }
- /**
- * Get mac
- *
- * @return string
- */
- public function getMac()
- {
- return $this->mac;
- }
- /**
- * Set serialNumber
- *
- * @param string $serialNumber
- *
- * @return ONU
- */
- public function setSerialNumber($serialNumber)
- {
- $this->serialNumber = $serialNumber;
- return $this;
- }
- /**
- * Get serialNumber
- *
- * @return string
- */
- public function getSerialNumber()
- {
- return $this->serialNumber;
- }
- /**
- * Set ponSerialNumber
- *
- * @param string $ponSerialNumber
- *
- * @return ONU
- */
- public function setPonSerialNumber($ponSerialNumber)
- {
- $this->ponSerialNumber = $ponSerialNumber;
- return $this;
- }
- /**
- * Get ponSerialNumber
- *
- * @return string
- */
- public function getPonSerialNumber()
- {
- return strtoupper($this->ponSerialNumber);
- }
- /**
- * Set ponPort
- *
- * @param string $ponPort
- *
- * @return ONU
- */
- public function setPonPort($ponPort)
- {
- $this->ponPort = $ponPort;
- return $this;
- }
- /**
- * Get ponPort
- *
- * @return string
- */
- public function getPonPort()
- {
- return $this->ponPort;
- }
- /**
- * @param int $deviceId
- *
- * @return ONU
- */
- public function setDeviceId($deviceId)
- {
- $this->deviceId = $deviceId;
- return $this;
- }
- /**
- * @return int
- */
- public function getDeviceId()
- {
- return $this->deviceId;
- }
- /**
- * @param int $oltDeviceId
- *
- * @return ONU
- */
- public function setOltDeviceId($oltDeviceId)
- {
- $this->oltDeviceId = $oltDeviceId;
- return $this;
- }
- /**
- * @return int
- */
- public function getOltDeviceId()
- {
- return $this->oltDeviceId;
- }
- /**
- * @return DeviceServer
- */
- public function getDeviceServer()
- {
- return $this->deviceServer;
- }
- /**
- * @param DeviceServer $deviceServer
- *
- * @return ONU
- */
- public function setDeviceServer($deviceServer)
- {
- $this->deviceServer = $deviceServer;
- return $this;
- }
- public function getShortType()
- {
- return str_replace("FTTHBundle\\Entity\\", "", $this->deviceType);
- }
- /**
- * Set tenancyId
- *
- * @param int $tenancyId
- *
- * @return ONU
- */
- public function setTenancyId($tenancyId)
- {
- $this->tenancyId = $tenancyId;
- return $this;
- }
- /**
- * Get tenancyId
- *
- * @return int
- */
- public function getTenancyId()
- {
- return $this->tenancyId;
- }
- /**
- * Set updated
- *
- * @param Datetime $tenancyId
- *
- * @return ONU
- */
- 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 ONU
- */
- public function setTxPower($txPower)
- {
- $this->txPower = $txPower;
- return $this;
- }
- /**
- * Get txPower
- *
- * @return decimal
- */
- public function getTxPower()
- {
- return $this->txPower;
- }
- /**
- * Set rxPower
- *
- * @param decimal $rxPower
- * @return ONU
- */
- public function setRxPower($rxPower)
- {
- $this->rxPower = $rxPower;
- return $this;
- }
- /**
- * Get rxPower
- *
- * @return decimal
- */
- public function getRxPower()
- {
- return $this->rxPower;
- }
- /**
- * Set voltage
- *
- * @param decimal $voltage
- * @return ONU
- */
- public function setVoltage($voltage)
- {
- $this->voltage = $voltage;
- return $this;
- }
- /**
- * Get voltage
- *
- * @return decimal
- */
- public function getVoltage()
- {
- return $this->voltage;
- }
- /**
- * Set temperature
- *
- * @param decimal $temperature
- * @return ONU
- */
- public function setTemperature($temperature)
- {
- $this->temperature = $temperature;
- return $this;
- }
- /**
- * Get temperature
- *
- * @return decimal
- */
- public function getTemperature()
- {
- return $this->temperature;
- }
- /**
- * Set uptime
- *
- * @param string $uptime
- * @return ONU
- */
- public function setUptime($uptime)
- {
- $this->uptime = $uptime;
- return $this;
- }
- /**
- * Get uptime
- *
- * @return string
- */
- public function getUptime()
- {
- return $this->uptime;
- }
- }
|