Evento.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. * @property string|null $redSocial
  21. *
  22. * @property EventoAccion[] $eventoAccions
  23. * @property EventoGrupo[] $eventoGrupos
  24. * @property Grupo[] $grupos
  25. * @property Red[] $reds
  26. * @property Resultado[] $resultados
  27. */
  28. class Evento extends \yii\db\ActiveRecord {
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public static function tableName() {
  33. return 'Evento';
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function rules() {
  39. return [
  40. [['nombre', 'url'], 'required'],
  41. [['descripcion', 'fotoEvento'], 'string'],
  42. [['fechaInicio', 'fechaFinal', 'creado', 'modificado', 'eliminado'], 'safe'],
  43. [['nombre'], 'string', 'max' => 500],
  44. [['tag', 'firebaseId'], 'string', 'max' => 50],
  45. [['url'], 'string', 'max' => 155],
  46. [['ciudad', 'redSocial'], 'string', 'max' => 100],
  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. 'redSocial' => 'Red Social',
  68. ];
  69. }
  70. /**
  71. * Gets query for [[eventoAcciones]].
  72. *
  73. * @return \yii\db\ActiveQuery
  74. */
  75. public function getEventoAcciones() {
  76. return $this->hasMany(EventoAccion::class, ['idEvento' => 'id']);
  77. }
  78. /**
  79. * Gets query for [[eventoGrupos]].
  80. *
  81. * @return \yii\db\ActiveQuery
  82. */
  83. public function getEventoGrupos() {
  84. return $this->hasMany(EventoGrupo::class, ['idEvento' => 'id']);
  85. }
  86. /**
  87. * Gets query for [[grupos]].
  88. *
  89. * @return \yii\db\ActiveQuery
  90. */
  91. public function getGrupos() {
  92. return $this->hasMany(Grupo::class, ['id' => 'idGrupo'])->viaTable('EventoGrupo', ['idEvento' => 'id']);
  93. }
  94. /**
  95. * Gets query for [[redes]].
  96. *
  97. * @return \yii\db\ActiveQuery
  98. */
  99. public function getRedes() {
  100. return $this->hasMany(Red::class, ['idEvento' => 'id']);
  101. }
  102. /**
  103. * Gets query for [[resultados]].
  104. *
  105. * @return \yii\db\ActiveQuery
  106. */
  107. public function getResultados() {
  108. return $this->hasMany(Resultado::class, ['idEvento' => 'id']);
  109. }
  110. }