|
@@ -0,0 +1,90 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+
|
|
|
|
|
+namespace app\models;
|
|
|
|
|
+
|
|
|
|
|
+use Yii;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * This is the model class for table "Agencia".
|
|
|
|
|
+ *
|
|
|
|
|
+ * @property int $idAgencia
|
|
|
|
|
+ * @property int|null $id
|
|
|
|
|
+ * @property string|null $nombre
|
|
|
|
|
+ * @property string|null $direccion
|
|
|
|
|
+ * @property string|null $contacto
|
|
|
|
|
+ * @property string|null $descripcion
|
|
|
|
|
+ * @property int|null $clave
|
|
|
|
|
+ * @property int|null $idUsuarioCreador
|
|
|
|
|
+ * @property string|null $creado
|
|
|
|
|
+ * @property string|null $modificado
|
|
|
|
|
+ * @property string|null $eliminado
|
|
|
|
|
+ *
|
|
|
|
|
+ * @property Usuario $id0
|
|
|
|
|
+ * @property Usuario[] $usuarios
|
|
|
|
|
+ */
|
|
|
|
|
+class Agencia extends \yii\db\ActiveRecord
|
|
|
|
|
+{
|
|
|
|
|
+ /**
|
|
|
|
|
+ * {@inheritdoc}
|
|
|
|
|
+ */
|
|
|
|
|
+ public static function tableName()
|
|
|
|
|
+ {
|
|
|
|
|
+ return 'Agencia';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * {@inheritdoc}
|
|
|
|
|
+ */
|
|
|
|
|
+ public function rules()
|
|
|
|
|
+ {
|
|
|
|
|
+ return [
|
|
|
|
|
+ [['id', 'clave', 'idUsuarioCreador'], 'default', 'value' => null],
|
|
|
|
|
+ [['id', 'clave', 'idUsuarioCreador'], 'integer'],
|
|
|
|
|
+ [['creado', 'modificado', 'eliminado'], 'safe'],
|
|
|
|
|
+ [['nombre'], 'string', 'max' => 50],
|
|
|
|
|
+ [['direccion'], 'string', 'max' => 20],
|
|
|
|
|
+ [['contacto', 'descripcion'], 'string', 'max' => 255],
|
|
|
|
|
+ [['id'], 'exist', 'skipOnError' => true, 'targetClass' => Usuario::class, 'targetAttribute' => ['id' => 'id']],
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * {@inheritdoc}
|
|
|
|
|
+ */
|
|
|
|
|
+ public function attributeLabels()
|
|
|
|
|
+ {
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'idAgencia' => 'Id Agencia',
|
|
|
|
|
+ 'id' => 'ID',
|
|
|
|
|
+ 'nombre' => 'Nombre',
|
|
|
|
|
+ 'direccion' => 'Direccion',
|
|
|
|
|
+ 'contacto' => 'Contacto',
|
|
|
|
|
+ 'descripcion' => 'Descripcion',
|
|
|
|
|
+ 'clave' => 'Clave',
|
|
|
|
|
+ 'idUsuarioCreador' => 'Id Usuario Creador',
|
|
|
|
|
+ 'creado' => 'Creado',
|
|
|
|
|
+ 'modificado' => 'Modificado',
|
|
|
|
|
+ 'eliminado' => 'Eliminado',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Gets query for [[Id0]].
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return \yii\db\ActiveQuery
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getIdUsuario()
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->hasOne(Usuario::class, ['id' => 'id']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Gets query for [[Usuarios]].
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return \yii\db\ActiveQuery
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getUsuario()
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->hasMany(Usuario::class, ['idAgencia' => 'idAgencia']);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|