Municipio.php 1.4 KB

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