Servicio.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 $idTipo
  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 $idTaller0
  19. * @property Vehiculo $idVehiculo0
  20. * @property TipoServicio $idTipo0
  21. * @property ServicioElemento[] $servicioElementos
  22. * @property ServicioTipoServicio[] $servicioTipoServicios
  23. */
  24. class Servicio extends ModeloBase
  25. {
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function tableName()
  30. {
  31. return 'Servicio';
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['id', 'factura'], 'required'],
  40. [['descripcion'], 'string'],
  41. [['fechaServicio', 'creado', 'modificado', 'eliminado'], 'safe'],
  42. [['id', 'idTaller', 'idVehiculo', ], 'string', 'max' => 36],
  43. [['factura'], 'string', 'max' => 100],
  44. [['id'], 'unique'],
  45. [['idTaller'], 'exist', 'skipOnError' => true, 'targetClass' => Taller::class, 'targetAttribute' => ['idTaller' => 'id']],
  46. [['idVehiculo'], 'exist', 'skipOnError' => true, 'targetClass' => Vehiculo::class, 'targetAttribute' => ['idVehiculo' => 'id']],
  47. ];
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. public function attributeLabels()
  53. {
  54. return [
  55. 'id' => 'ID',
  56. 'factura' => 'Factura',
  57. 'descripcion' => 'Descripcion',
  58. 'fechaServicio' => 'Fecha Servicio',
  59. 'idTaller' => 'Id Taller',
  60. 'idVehiculo' => 'Id Vehiculo',
  61. 'idTipo' => 'Id Tipo',
  62. 'creado' => 'Creado',
  63. 'modificado' => 'Modificado',
  64. 'eliminado' => 'Eliminado',
  65. ];
  66. }
  67. /**
  68. * Gets query for [[IdTaller0]].
  69. *
  70. * @return \yii\db\ActiveQuery
  71. */
  72. public function getTaller()
  73. {
  74. return $this->hasOne(Taller::class, ['id' => 'idTaller']);
  75. }
  76. public function getVehiculo()
  77. {
  78. return $this->hasOne(Vehiculo::class, ['id' => 'idVehiculo']);
  79. }
  80. public function getServicioElemento()
  81. {
  82. return $this->hasMany(ServicioElemento::class, ['idServicio' => 'id']);
  83. }
  84. public function getTipoServicio()
  85. {
  86. return $this->hasMany(ServicioTipoServicio::class, ['idServicio' => 'id']);
  87. }
  88. }