HerramientaObra.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "HerramientaObra"
  6. *
  7. * @property string $id
  8. * @property string $idEmpleado
  9. * @property string $idHerramienta
  10. * @property string $idObra
  11. * @property string|null comentario
  12. *
  13. * @property Empleado $idEmpleado
  14. * @property Herramienta $idHerramienta
  15. * @property Obra $idObra
  16. *
  17. */
  18. class HerramientaObra extends ModeloBase
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public static function tableName()
  24. {
  25. return 'HerramientaObra';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function rules(){
  31. return[
  32. [['id','idEmpleado', 'idHerramienta','idObra'],'required'],
  33. [['comentario'],'string', 'max'=>100],
  34. [['creado', 'modificado','eliminado'],'safe'],
  35. [['id','idEmpleado', 'idHerramienta','idObra'],'string', 'max'=>36],
  36. [['idEmpleado'], 'exist', 'skipOnError' => true, 'targetClass' => Empleado::class, 'targetAttribute' => ['idEmpleado' => 'id']],
  37. [['idHerramienta'], 'exist', 'skipOnError' => true, 'targetClass' => Herramienta::class, 'targetAttribute' => ['idHerramienta' => 'id']],
  38. [['idObra'], 'exist', 'skipOnError' => true, 'targetClass' => Obra::class, 'targetAttribute' => ['idObra' => 'id']],
  39. ];
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function attributeLabels()
  45. {
  46. return [
  47. 'id'=>'ID',
  48. 'idEmpleado'=>'ID Empleado',
  49. 'idHerramienta'=>'ID Herramienta',
  50. 'idObra'=>'ID Obra',
  51. 'comentario'=>'Comentario',
  52. ];
  53. }
  54. /**
  55. * Gets query for [[IdEmpleado]].
  56. *
  57. * @return \yii\db\ActiveQuery
  58. *
  59. */
  60. public function getEmpleado()
  61. {
  62. return $this->hasOne(Empleado::class, ['id' => 'idEmpleado']);
  63. }
  64. /**
  65. * Gets query for [[IdHerramienta]].
  66. *
  67. * @return \yii\db\ActiveQuery
  68. *
  69. */
  70. public function getHerramienta()
  71. {
  72. return $this->hasOne(Herramienta::class, ['id' => 'idHerramienta']);
  73. }
  74. /**
  75. * Gets query for [[IdObra]].
  76. *
  77. * @return \yii\db\ActiveQuery
  78. *
  79. */
  80. public function getObra()
  81. {
  82. return $this->hasOne(Obra::class, ['id' => 'idObra']);
  83. }
  84. }