EventoAccion.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "EventoAccion".
  6. *
  7. * @property int $idEvento
  8. * @property string $accion
  9. *
  10. * @property Evento $evento
  11. */
  12. class EventoAccion extends \yii\db\ActiveRecord {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public static function tableName() {
  17. return 'EventoAccion';
  18. }
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function rules() {
  23. return [
  24. [['idEvento', 'accion'], 'required'],
  25. [['idEvento'], 'default', 'value' => null],
  26. [['idEvento'], 'integer'],
  27. [['accion'], 'string', 'max' => 10],
  28. [['idEvento', 'accion'], 'unique', 'targetAttribute' => ['idEvento', 'accion']],
  29. [['idEvento'], 'exist', 'skipOnError' => true, 'targetClass' => Evento::class, 'targetAttribute' => ['idEvento' => 'id']],
  30. ];
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function attributeLabels() {
  36. return [
  37. 'idEvento' => 'Id Evento',
  38. 'accion' => 'Accion',
  39. ];
  40. }
  41. /**
  42. * Gets query for [[evento]].
  43. *
  44. * @return \yii\db\ActiveQuery
  45. */
  46. public function getEvento() {
  47. return $this->hasOne(Evento::class, ['id' => 'idEvento']);
  48. }
  49. }