Red.php 1.3 KB

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