ObraEmpleado.php 1.8 KB

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