Estado.php 1.4 KB

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