Nivel.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Nivel".
  6. *
  7. * @property string $id
  8. * @property string|null $nombre
  9. * @property string|null $idMunicipio
  10. * @property string|null $clave
  11. * @property string|null $creado
  12. * @property string|null $modificado
  13. * @property string|null $eliminado
  14. *
  15. * @property Municipio $idMunicipio0
  16. */
  17. class Nivel extends ModeloBase
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public static function tableName()
  23. {
  24. return 'Nivel';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['id'], 'required'],
  33. [['creado', 'modificado', 'eliminado'], 'safe'],
  34. [['id', 'idMunicipio'], 'string', 'max' => 36],
  35. [['nombre', 'clave'], 'string', 'max' => 100],
  36. [['id'], 'unique'],
  37. [['idMunicipio'], 'exist', 'skipOnError' => true, 'targetClass' => Municipio::class, 'targetAttribute' => ['idMunicipio' => 'id']],
  38. ];
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'id' => 'ID',
  47. 'nombre' => 'Nombre',
  48. 'idMunicipio' => 'Id Municipio',
  49. 'clave' => 'Clave',
  50. 'creado' => 'Creado',
  51. 'modificado' => 'Modificado',
  52. 'eliminado' => 'Eliminado',
  53. ];
  54. }
  55. /**
  56. * Gets query for [[IdMunicipio0]].
  57. *
  58. * @return \yii\db\ActiveQuery
  59. */
  60. public function getIdMunicipio()
  61. {
  62. return $this->hasOne(Municipio::class, ['id' => 'idMunicipio']);
  63. }
  64. }