فهرست منبع

FD3-800 asserts added in SubNet entity

Guillermo Espinoza 6 سال پیش
والد
کامیت
2a38c99b02
2فایلهای تغییر یافته به همراه11 افزوده شده و 4 حذف شده
  1. 0 1
      src/IPv4Bundle/Admin/SubNetAdmin.php
  2. 11 3
      src/IPv4Bundle/Entity/SubNet.php

+ 0 - 1
src/IPv4Bundle/Admin/SubNetAdmin.php

@@ -65,7 +65,6 @@ class SubNetAdmin extends BaseAdmin
                 ->add('address')
                 ->add('allowedHostType')
                 ->add('status', ChoiceType::class, [
-                    'required' => false,
                     'choices' => HostStatus::getChoices(),
                     'translation_domain' => 'WorkflowLabel',
                 ])

+ 11 - 3
src/IPv4Bundle/Entity/SubNet.php

@@ -44,6 +44,7 @@ class SubNet implements TenancyIdTraitInterface, WorkflowInterface
      * @ORM\Column(type="string", length=100, unique=true)
      *
      * @Assert\Regex(pattern="/^[ A-Za-z0-9_\-ñÑ:.\/]+$/")
+     * @Assert\NotBlank
      */
     protected $address;
 
@@ -52,6 +53,8 @@ class SubNet implements TenancyIdTraitInterface, WorkflowInterface
      *
      * @ORM\ManyToOne(targetEntity="HostBundle\Entity\HostType")
      * @ORM\JoinColumn(onDelete="CASCADE")
+     * 
+     * @Assert\NotNull
      */
     protected $allowedHostType;
 
@@ -67,6 +70,8 @@ class SubNet implements TenancyIdTraitInterface, WorkflowInterface
      *
      * @ORM\ManyToOne(targetEntity="NetGroup", inversedBy="subNets")
      * @ORM\JoinColumn(onDelete="CASCADE")
+     * 
+     * @Assert\NotNull
      */
     protected $netGroup;
 
@@ -80,6 +85,7 @@ class SubNet implements TenancyIdTraitInterface, WorkflowInterface
     /**
      * @ORM\ManyToOne(targetEntity="\WorkflowBundle\Entity\Workflow", fetch="EXTRA_LAZY")
      * @ORM\JoinColumn(name="workflow_id", referencedColumnName="id", onDelete="SET NULL")
+     * 
      * @JMS\MaxDepth(1)
      */
     protected $workflow;
@@ -90,9 +96,11 @@ class SubNet implements TenancyIdTraitInterface, WorkflowInterface
     protected $currentState = null;
 
     /**
-     * @ORM\Column(type="string", nullable=true)
+     * @ORM\Column(type="string")
+     * 
+     * @Assert\NotBlank
      */
-    protected $status = null;
+    protected $status = \HostBundle\Utils\HostStatus::STATE_ACTIVE;
 
 
     public function __construct()
@@ -181,7 +189,7 @@ class SubNet implements TenancyIdTraitInterface, WorkflowInterface
      *
      * @return SubNet
      */
-    public function setNetGroup(NetGroup $netGroup = null)
+    public function setNetGroup(NetGroup $netGroup)
     {
         $this->netGroup = $netGroup;