Evento.php 821 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace v1\models;
  3. use app\models\Evento as ModeloEvento;
  4. class Evento extends ModeloEvento {
  5. public function fields() {
  6. return [
  7. 'id',
  8. 'nombre',
  9. 'descripcion',
  10. 'fotoEvento',
  11. 'tag',
  12. 'url',
  13. 'fechaInicio',
  14. 'fechaFinal',
  15. 'creado',
  16. 'modificado',
  17. 'eliminado',
  18. 'firebaseId'
  19. ];
  20. }
  21. public function extraFields() {
  22. return [
  23. 'eventoGrupos',
  24. 'grupos',
  25. 'resultados',
  26. ];
  27. }
  28. public function getEventoGrupos() {
  29. return $this->hasMany(EventoGrupo::className(), ['idEvento' => 'id']);
  30. }
  31. public function getGrupos() {
  32. return $this->hasMany(Grupo::className(), ['id' => 'idGrupo'])->viaTable('EventoGrupo', ['idEvento' => 'id']);
  33. }
  34. public function getResultados() {
  35. return $this->hasMany(Resultado::className(), ['idEvento' => 'id']);
  36. }
  37. }