Evento.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 int|null $idGrupo
  9. * @property string $nombre
  10. * @property string|null $descripcion
  11. * @property string|null $fotoEvento
  12. * @property string|null $tag
  13. * @property string $url
  14. * @property string|null $fechaInicio
  15. * @property string|null $fechaFinal
  16. * @property string|null $creado
  17. * @property string|null $modificado
  18. * @property string|null $eliminado
  19. *
  20. * @property Grupo $grupo
  21. * @property Resultado[] $resultados
  22. */
  23. class Evento extends \yii\db\ActiveRecord {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName() {
  28. return 'Evento';
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function rules() {
  34. return [
  35. [['idGrupo'], 'default', 'value' => null],
  36. [['idGrupo'], 'integer'],
  37. [['nombre', 'url'], 'required'],
  38. [['fotoEvento'], 'string'],
  39. [['fechaInicio', 'fechaFinal', 'creado', 'modificado', 'eliminado'], 'safe'],
  40. [['nombre'], 'string', 'max' => 100],
  41. [['descripcion'], 'string', 'max' => 255],
  42. [['tag'], 'string', 'max' => 50],
  43. [['url'], 'string', 'max' => 155],
  44. [['tag'], 'unique'],
  45. [['idGrupo'], 'exist', 'skipOnError' => true, 'targetClass' => Grupo::className(), 'targetAttribute' => ['idGrupo' => 'id']],
  46. ];
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function attributeLabels() {
  52. return [
  53. 'id' => 'ID',
  54. 'idGrupo' => 'Id Grupo',
  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. ];
  66. }
  67. /**
  68. * Gets query for [[grupo]].
  69. *
  70. * @return \yii\db\ActiveQuery
  71. */
  72. public function getGrupo() {
  73. return $this->hasOne(Grupo::className(), ['id' => 'idGrupo']);
  74. }
  75. /**
  76. * Gets query for [[resultados]].
  77. *
  78. * @return \yii\db\ActiveQuery
  79. */
  80. public function getResultados() {
  81. return $this->hasMany(Resultado::className(), ['idEvento' => 'id']);
  82. }
  83. }