Evento.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Evento".
  6. *
  7. * @property int $id
  8. * @property string $nombre
  9. * @property string|null $descripcion
  10. * @property string|null $fotoEvento
  11. * @property string|null $tag
  12. * @property string $url
  13. * @property string|null $fechaInicio
  14. * @property string|null $fechaFinal
  15. * @property string|null $creado
  16. * @property string|null $modificado
  17. * @property string|null $eliminado
  18. * @property string|null $firebaseId
  19. * @property string|null $ciudad
  20. *
  21. * @property EventoAccion[] $eventoAccions
  22. * @property EventoGrupo[] $eventoGrupos
  23. * @property Grupo[] $grupos
  24. * @property Red[] $reds
  25. * @property Resultado[] $resultados
  26. */
  27. class Evento extends \yii\db\ActiveRecord {
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public static function tableName() {
  32. return 'Evento';
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function rules() {
  38. return [
  39. [['nombre', 'url'], 'required'],
  40. [['descripcion', 'fotoEvento'], 'string'],
  41. [['fechaInicio', 'fechaFinal', 'creado', 'modificado', 'eliminado'], 'safe'],
  42. [['nombre'], 'string', 'max' => 255],
  43. [['tag', 'firebaseId'], 'string', 'max' => 50],
  44. [['url'], 'string', 'max' => 155],
  45. [['ciudad'], 'string', 'max' => 100],
  46. [['tag'], 'unique'],
  47. ];
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. public function attributeLabels() {
  53. return [
  54. 'id' => 'ID',
  55. 'nombre' => 'Nombre',
  56. 'descripcion' => 'Descripcion',
  57. 'fotoEvento' => 'Foto Evento',
  58. 'tag' => 'Tag',
  59. 'url' => 'Url',
  60. 'fechaInicio' => 'Fecha Inicio',
  61. 'fechaFinal' => 'Fecha Final',
  62. 'creado' => 'Creado',
  63. 'modificado' => 'Modificado',
  64. 'eliminado' => 'Eliminado',
  65. 'firebaseId' => 'Firebase ID',
  66. 'ciudad' => 'Ciudad',
  67. ];
  68. }
  69. /**
  70. * Gets query for [[eventoAcciones]].
  71. *
  72. * @return \yii\db\ActiveQuery
  73. */
  74. public function getEventoAcciones() {
  75. return $this->hasMany(EventoAccion::class, ['idEvento' => 'id']);
  76. }
  77. /**
  78. * Gets query for [[eventoGrupos]].
  79. *
  80. * @return \yii\db\ActiveQuery
  81. */
  82. public function getEventoGrupos() {
  83. return $this->hasMany(EventoGrupo::class, ['idEvento' => 'id']);
  84. }
  85. /**
  86. * Gets query for [[grupos]].
  87. *
  88. * @return \yii\db\ActiveQuery
  89. */
  90. public function getGrupos() {
  91. return $this->hasMany(Grupo::class, ['id' => 'idGrupo'])->viaTable('EventoGrupo', ['idEvento' => 'id']);
  92. }
  93. /**
  94. * Gets query for [[redes]].
  95. *
  96. * @return \yii\db\ActiveQuery
  97. */
  98. public function getRedes() {
  99. return $this->hasMany(Red::class, ['idEvento' => 'id']);
  100. }
  101. /**
  102. * Gets query for [[resultados]].
  103. *
  104. * @return \yii\db\ActiveQuery
  105. */
  106. public function getResultados() {
  107. return $this->hasMany(Resultado::class, ['idEvento' => 'id']);
  108. }
  109. }