|
@@ -3,26 +3,31 @@
|
|
|
namespace StatsBundle\Entity;
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
-use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
-use Symfony\Component\Workflow\Exception\ExceptionInterface;
|
|
|
-
|
|
|
+use JMS\Serializer\Annotation as JMS;
|
|
|
|
|
|
/**
|
|
|
* @ORM\Table
|
|
|
- * @ORM\Entity
|
|
|
+ * @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 string
|
|
|
+ * @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;
|
|
@@ -30,16 +35,14 @@ class Onu
|
|
|
/**
|
|
|
* @var int
|
|
|
*
|
|
|
- * @ORM\Id
|
|
|
* @ORM\Column(type="integer", nullable=true)
|
|
|
- *
|
|
|
*/
|
|
|
- private $oltDeviceId;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Id
|
|
|
+ private $oltDeviceId;
|
|
|
+
|
|
|
+ /**
|
|
|
* @ORM\ManyToOne(targetEntity="DeviceServer", inversedBy="devices", fetch="EXTRA_LAZY")
|
|
|
*
|
|
|
+ * @JMS\MaxDepth(1)
|
|
|
*/
|
|
|
protected $deviceServer;
|
|
|
|
|
@@ -47,17 +50,16 @@ class Onu
|
|
|
* @var int
|
|
|
*
|
|
|
* @ORM\Column(type="integer", nullable=true)
|
|
|
- *
|
|
|
*/
|
|
|
- private $deviceId;
|
|
|
-
|
|
|
+ private $deviceId;
|
|
|
+
|
|
|
/**
|
|
|
* @var int
|
|
|
*
|
|
|
* @ORM\Column(type="integer", nullable=false, options={"default":1})
|
|
|
*/
|
|
|
protected $tenancyId = 1;
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* @var string
|
|
|
*
|
|
@@ -66,21 +68,21 @@ class Onu
|
|
|
* @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)
|
|
|
*/
|
|
@@ -90,22 +92,22 @@ class Onu
|
|
|
* @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)
|
|
|
*/
|
|
@@ -120,11 +122,20 @@ class Onu
|
|
|
* @ORM\Column(type="datetime")
|
|
|
*/
|
|
|
protected $updated;
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public function getId()
|
|
|
+ {
|
|
|
+ return $this->id;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function getId()
|
|
|
+ public function getCustomId()
|
|
|
{
|
|
|
return sprintf('%s~%s~%s', strtolower($this->ponSerialNumber), $this->oltDeviceId, $this->deviceServer->getId());
|
|
|
}
|
|
@@ -229,7 +240,7 @@ class Onu
|
|
|
return strtoupper($this->ponSerialNumber);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* Set ponPort
|
|
|
*
|
|
|
* @param string $ponPort
|
|
@@ -272,7 +283,7 @@ class Onu
|
|
|
{
|
|
|
return $this->deviceId;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* @param int $oltDeviceId
|
|
|
*
|
|
@@ -313,9 +324,9 @@ class Onu
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- public function getShortType()
|
|
|
+ public function getShortType()
|
|
|
{
|
|
|
- return str_replace("FTTHBundle\\Entity\\","",$this->deviceType);
|
|
|
+ return str_replace("FTTHBundle\\Entity\\", "", $this->deviceType);
|
|
|
}
|
|
|
|
|
|
/**
|