Servicio.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Servicio".
  6. *
  7. * @property string $id
  8. * @property string $factura
  9. * @property string $tipo
  10. * @property string|null $descripcion
  11. * @property string|null $fechaServicio
  12. * @property string|null $idTaller
  13. * @property string|null $idVehiculo
  14. * @property string|null $creado
  15. * @property string|null $modificado
  16. * @property string|null $eliminado
  17. *
  18. * @property Taller $idTaller
  19. * @property Vehiculo $idVehiculo
  20. * @property ServicioElemento[] $servicioElementos
  21. */
  22. class Servicio extends ModeloBase
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return 'Servicio';
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['id', 'factura', 'tipo'], 'required'],
  38. [['descripcion'], 'string'],
  39. [['fechaServicio', 'creado', 'modificado', 'eliminado'], 'safe'],
  40. [['id', 'idTaller', 'idVehiculo'], 'string', 'max' => 36],
  41. [['factura', 'tipo'], 'string', 'max' => 100],
  42. [['id'], 'unique'],
  43. [['idTaller'], 'exist', 'skipOnError' => true, 'targetClass' => Taller::class, 'targetAttribute' => ['idTaller' => 'id']],
  44. [['idVehiculo'], 'exist', 'skipOnError' => true, 'targetClass' => Vehiculo::class, 'targetAttribute' => ['idVehiculo' => 'id']],
  45. ];
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function attributeLabels()
  51. {
  52. return [
  53. 'id' => 'ID',
  54. 'factura' => 'Factura',
  55. 'tipo' => 'Tipo',
  56. 'descripcion' => 'Descripcion',
  57. 'fechaServicio' => 'Fecha Servicio',
  58. 'idTaller' => 'Id Taller',
  59. 'idVehiculo' => 'Id Vehiculo',
  60. 'creado' => 'Creado',
  61. 'modificado' => 'Modificado',
  62. 'eliminado' => 'Eliminado',
  63. ];
  64. }
  65. /**
  66. * Gets query for [[IdTaller0]].
  67. *
  68. * @return \yii\db\ActiveQuery
  69. */
  70. public function getTaller()
  71. {
  72. return $this->hasOne(Taller::class, ['id' => 'idTaller']);
  73. }
  74. /**
  75. * Gets query for [[IdVehiculo0]].
  76. *
  77. * @return \yii\db\ActiveQuery
  78. */
  79. public function getVehiculo()
  80. {
  81. return $this->hasOne(Vehiculo::class, ['id' => 'idVehiculo']);
  82. }
  83. /**
  84. * Gets query for [[ServicioElementos]].
  85. *
  86. * @return \yii\db\ActiveQuery
  87. */
  88. public function getServicioElemento()
  89. {
  90. return $this->hasMany(ServicioElemento::class, ['idServicio' => 'id']);
  91. }
  92. }