Przeglądaj źródła

FD3-414 fix asociación nap->olt. Se quitaron validaciones notNull en Nap y ONU

Guillermo Espinoza 7 lat temu
rodzic
commit
e179694312

+ 1 - 3
src/FTTHBundle/Entity/NAP.php

@@ -66,9 +66,7 @@ class NAP implements TenancyIdTraitInterface, LocationInterface
     private $container;
 
     /**
-     * @ORM\ManyToOne(targetEntity="OLT", inversedBy="onus", fetch="EXTRA_LAZY")
-     *
-     * @Assert\NotNull
+     * @ORM\ManyToOne(targetEntity="OLT", inversedBy="naps", fetch="EXTRA_LAZY")
      *
      * @JMS\MaxDepth(1)
      */

+ 39 - 0
src/FTTHBundle/Entity/OLT.php

@@ -99,6 +99,13 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      */
     protected $onus;
 
+    /**
+     * @ORM\OneToMany(targetEntity="NAP", mappedBy="olt", fetch="EXTRA_LAZY")
+     *
+     * @JMS\MaxDepth(2)
+     */
+    protected $naps;
+
     /**
      * @ORM\Column(type="string", nullable=true)
      */
@@ -289,6 +296,38 @@ class OLT implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
         return $this->onus;
     }
 
+    /**
+     * @param NAP $nap
+     *
+     * @return OLT
+     */
+    public function addNap(NAP $nap)
+    {
+        $this->naps[] = $nap;
+
+        return $this;
+    }
+
+    /**
+     * @param NAP $nap
+     *
+     * @return OLT
+     */
+    public function removeNap(NAP $nap)
+    {
+        $this->naps->removeElement($nap);
+
+        return $this;
+    }
+
+    /**
+     * @return Doctrine\Common\Collections\Collection
+     */
+    public function getNaps()
+    {
+        return $this->naps;
+    }
+
     /**
      * @return OLTModel
      */

+ 0 - 2
src/FTTHBundle/Entity/ONU.php

@@ -128,8 +128,6 @@ class ONU implements DeviceInterface, TenancyIdTraitInterface, LocationInterface
      * @ORM\ManyToOne(targetEntity="NAP", inversedBy="onus", fetch="EXTRA_LAZY")
      *
      * @JMS\MaxDepth(1)
-     *
-     * @Assert\NotNull
      */
     protected $nap;