NivelMunicipio.php 1.7 KB

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