Bladeren bron

Merge branch 'master' of git.miralo.xyz:SAGARHPA/Sagarhpa_2024_api_php

ElPoteito 8 maanden geleden
bovenliggende
commit
5a091b2fe8

+ 31 - 0
migrations/m240803_012148_agregando_nivel_a_condicionante.php

@@ -0,0 +1,31 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m240803_012148_agregando_nivel_a_condicionante
+ */
+class m240803_012148_agregando_nivel_a_condicionante extends Migration {
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp() {
+        $this->addColumn('Condicionante', 'idNivel', $this->string(36));
+
+        $this->addForeignKey(
+            'fk_Condicionante_Nivel',
+            'Condicionante',
+            'idNivel',
+            'Nivel',
+            'id',
+        );
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown() {
+        $this->dropForeignKey('fk_Condicionante_Nivel', 'Condicionante');
+        $this->dropColumn('Condicionante', 'idNivel');
+    }
+}

+ 13 - 0
models/Condicionante.php

@@ -19,6 +19,7 @@ use Yii;
  * @property string|null $creado
  * @property string|null $modificado
  * @property string|null $eliminado
+ * @property string|null $idNivel
  *
  * @property CondicionanteDestino[] $condicionanteDestino
  * @property CondicionanteFin[] $condicionanteFin
@@ -31,6 +32,7 @@ use Yii;
  * @property Estado[] $idOrigen
  * @property Producto $idProducto
  * @property TipoMovilizacion[] $idTipo
+ * @property Nivel $idNivel
  */
 class Condicionante extends ModeloBase {
     /**
@@ -56,6 +58,7 @@ class Condicionante extends ModeloBase {
             [['idProducto'], 'exist', 'skipOnError' => true, 'targetClass' => Producto::class, 'targetAttribute' => ['idProducto' => 'id']],
             [['idCreador'], 'exist', 'skipOnError' => true, 'targetClass' => Usuario::class, 'targetAttribute' => ['idCreador' => 'id']],
             [['idModificador'], 'exist', 'skipOnError' => true, 'targetClass' => Usuario::class, 'targetAttribute' => ['idModificador' => 'id']],
+            [['idNivel'], 'exist', 'skipOnError' => true, 'targetClass' => Nivel::class, 'targetAttribute' => ['idNivel' => 'id']],
         ];
     }
 
@@ -76,6 +79,7 @@ class Condicionante extends ModeloBase {
             'creado' => 'Creado',
             'modificado' => 'Modificado',
             'eliminado' => 'Eliminado',
+            'idNivel' => 'Id Nivel',
         ];
     }
 
@@ -177,4 +181,13 @@ class Condicionante extends ModeloBase {
     public function getIdTipos() {
         return $this->hasMany(TipoMovilizacion::class, ['id' => 'idTipo'])->viaTable('CondicionanteTipo', ['idCondicionante' => 'id']);
     }
+
+    /**
+     * Gets query for [[IdNivel]].
+     *
+     * @return \yii\db\ActiveQuery
+     */
+    public function getIdNivel() {
+        return $this->hasOne(Nivel::class, ['id' => 'idNivel']);
+    }
 }

+ 1 - 0
modules/v1/models/Condicionante.php

@@ -19,6 +19,7 @@ class Condicionante extends ModelsCondicionante {
       'creado',
       'modificado',
       'eliminado',
+      'idNivel'
     ];
   }