Agencia.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Agencia".
  6. *
  7. * @property int $idAgencia
  8. * @property int|null $id
  9. * @property string|null $nombre
  10. * @property string|null $direccion
  11. * @property string|null $contacto
  12. * @property string|null $descripcion
  13. * @property int|null $clave
  14. * @property int|null $idUsuarioCreador
  15. * @property string|null $creado
  16. * @property string|null $modificado
  17. * @property string|null $eliminado
  18. *
  19. * @property Usuario $id0
  20. * @property Usuario[] $usuarios
  21. */
  22. class Agencia extends \yii\db\ActiveRecord
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return 'Agencia';
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['id', 'clave', 'idUsuarioCreador'], 'default', 'value' => null],
  38. [['id', 'clave', 'idUsuarioCreador'], 'integer'],
  39. [['creado', 'modificado', 'eliminado'], 'safe'],
  40. [['nombre'], 'string', 'max' => 50],
  41. [['direccion'], 'string', 'max' => 20],
  42. [['contacto', 'descripcion'], 'string', 'max' => 255],
  43. [['id'], 'exist', 'skipOnError' => true, 'targetClass' => Usuario::class, 'targetAttribute' => ['id' => 'id']],
  44. ];
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. public function attributeLabels()
  50. {
  51. return [
  52. 'idAgencia' => 'Id Agencia',
  53. 'id' => 'ID',
  54. 'nombre' => 'Nombre',
  55. 'direccion' => 'Direccion',
  56. 'contacto' => 'Contacto',
  57. 'descripcion' => 'Descripcion',
  58. 'clave' => 'Clave',
  59. 'idUsuarioCreador' => 'Id Usuario Creador',
  60. 'creado' => 'Creado',
  61. 'modificado' => 'Modificado',
  62. 'eliminado' => 'Eliminado',
  63. ];
  64. }
  65. /**
  66. * Gets query for [[Id0]].
  67. *
  68. * @return \yii\db\ActiveQuery
  69. */
  70. public function getIdUsuario()
  71. {
  72. return $this->hasOne(Usuario::class, ['id' => 'id']);
  73. }
  74. /**
  75. * Gets query for [[Usuarios]].
  76. *
  77. * @return \yii\db\ActiveQuery
  78. */
  79. public function getUsuario()
  80. {
  81. return $this->hasMany(Usuario::class, ['idAgencia' => 'idAgencia']);
  82. }
  83. }