|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
namespace FTTHBundle\Entity;
|
|
|
|
|
|
+use Base\AdminBundle\Traits\TenancyIdTrait;
|
|
|
+use Base\AdminBundle\Traits\TenancyIdTraitInterface;
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
|
|
|
use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
|
|
@@ -20,14 +22,14 @@ use JMS\Serializer\Annotation as JMS;
|
|
|
* @ORM\HasLifecycleCallbacks
|
|
|
* @UniqueEntity(fields={"ponSerialNumber", "tenancyId"}, message="errors.duplicate_key")
|
|
|
* @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="unique_idx", columns={"pon_serial_number", "tenancy_id"})})
|
|
|
- *
|
|
|
+ *
|
|
|
* @ValidatorAssert\Device
|
|
|
*/
|
|
|
-class ONU implements DeviceInterface
|
|
|
+class ONU implements DeviceInterface, TenancyIdTraitInterface
|
|
|
{
|
|
|
|
|
|
use ExtraDataTrait;
|
|
|
-
|
|
|
+ use TenancyIdTrait;
|
|
|
/**
|
|
|
* @var int
|
|
|
*
|
|
@@ -87,17 +89,17 @@ class ONU implements DeviceInterface
|
|
|
protected $updated;
|
|
|
|
|
|
/**
|
|
|
- * @ORM\Column(type="string", nullable=true)
|
|
|
+ * @ORM\Column(type="string", nullable=true)
|
|
|
*/
|
|
|
protected $currentState = null;
|
|
|
|
|
|
/**
|
|
|
- * @ORM\Column(type="string", nullable=true, options={"default": "active"})
|
|
|
+ * @ORM\Column(type="string", nullable=true, options={"default": "active"})
|
|
|
*/
|
|
|
protected $administrativeState = 'active';
|
|
|
|
|
|
/**
|
|
|
- * @ORM\Column(type="string", nullable=false, options={"default": "success"})
|
|
|
+ * @ORM\Column(type="string", nullable=false, options={"default": "success"})
|
|
|
*/
|
|
|
protected $transitionState = 'success';
|
|
|
|
|
@@ -126,13 +128,6 @@ class ONU implements DeviceInterface
|
|
|
*/
|
|
|
protected $profile;
|
|
|
|
|
|
- /**
|
|
|
- * @var int
|
|
|
- *
|
|
|
- * @ORM\Column(type="integer", nullable=false, options={"default":1})
|
|
|
- */
|
|
|
- protected $tenancyId = 1;
|
|
|
-
|
|
|
/**
|
|
|
* @ORM\ManyToOne(targetEntity="\WorkflowBundle\Entity\Workflow", fetch="EXTRA_LAZY")
|
|
|
* @ORM\JoinColumn(name="workflow_id", referencedColumnName="id", onDelete="SET NULL")
|
|
@@ -144,7 +139,7 @@ class ONU implements DeviceInterface
|
|
|
* @var int
|
|
|
*
|
|
|
* @ORM\Column(type="integer", nullable=false, options={"default": "0"})
|
|
|
- *
|
|
|
+ *
|
|
|
* @Assert\Callback({"FTTHBundle\Validator\ONUPositionValidator", "validate"})
|
|
|
*/
|
|
|
private $position = 0;
|
|
@@ -155,7 +150,7 @@ class ONU implements DeviceInterface
|
|
|
*/
|
|
|
public function __toString()
|
|
|
{
|
|
|
- return (string) $this->ponSerialNumber;
|
|
|
+ return (string)$this->ponSerialNumber;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -368,20 +363,6 @@ class ONU implements DeviceInterface
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Set tenancyId
|
|
|
- *
|
|
|
- * @param int $tenancyId
|
|
|
- *
|
|
|
- * @return ONU
|
|
|
- */
|
|
|
- public function setTenancyId($tenancyId)
|
|
|
- {
|
|
|
- $this->tenancyId = $tenancyId;
|
|
|
-
|
|
|
- return $this;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @return OLT
|
|
|
*/
|
|
@@ -430,7 +411,7 @@ class ONU implements DeviceInterface
|
|
|
|
|
|
/**
|
|
|
* @param NAP $nap
|
|
|
- *
|
|
|
+ *
|
|
|
* @return $this
|
|
|
*/
|
|
|
public function setNap($nap)
|
|
@@ -459,16 +440,6 @@ class ONU implements DeviceInterface
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Get tenancyId
|
|
|
- *
|
|
|
- * @return int
|
|
|
- */
|
|
|
- public function getTenancyId()
|
|
|
- {
|
|
|
- return $this->tenancyId;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @return Workflow
|
|
|
*/
|
|
@@ -530,7 +501,7 @@ class ONU implements DeviceInterface
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @ORM\PrePersist
|
|
|
+ * @ORM\PrePersist
|
|
|
*/
|
|
|
public function prePersist(LifecycleEventArgs $event)
|
|
|
{
|
|
@@ -604,7 +575,7 @@ class ONU implements DeviceInterface
|
|
|
* De lo contrario recorre y retorna la primer position
|
|
|
* desocupada dentro del rango de ONUs que esten asociadas
|
|
|
* al NAP
|
|
|
- *
|
|
|
+ *
|
|
|
* @return int
|
|
|
*/
|
|
|
public function getNewPosition()
|
|
@@ -645,18 +616,18 @@ class ONU implements DeviceInterface
|
|
|
$deviceData['tenancyId'] = $this->tenancyId;
|
|
|
|
|
|
$deviceExtraData = array('mac' => $this->mac, 'serialNumber' => $this->serialNumber, 'ponSerialNumber' => $this->ponSerialNumber,
|
|
|
- 'clientId' => $this->clientId);
|
|
|
+ 'clientId' => $this->clientId);
|
|
|
|
|
|
- ($this->olt)? $olt = $this->getOlt()->getId() : $olt = null;
|
|
|
- ($this->model)? $model = $this->getModel()->getId() : $model = null;
|
|
|
- ($this->nap)? $nap = $this->getNap()->getId() : $nap = null;
|
|
|
- ($this->profile)? $profile = $this->getProfile()->getId() : $profile = null;
|
|
|
+ ($this->olt) ? $olt = $this->getOlt()->getId() : $olt = null;
|
|
|
+ ($this->model) ? $model = $this->getModel()->getId() : $model = null;
|
|
|
+ ($this->nap) ? $nap = $this->getNap()->getId() : $nap = null;
|
|
|
+ ($this->profile) ? $profile = $this->getProfile()->getId() : $profile = null;
|
|
|
|
|
|
$deviceExtraData['oltId'] = $olt;
|
|
|
$deviceExtraData['modelId'] = $model;
|
|
|
$deviceExtraData['napId'] = $nap;
|
|
|
$deviceExtraData['profileId'] = $profile;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
$deviceData['extraData'] = json_encode($deviceExtraData);
|
|
|
|