HerramientaInventario.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Herramienta Inventario"
  6. *
  7. * @property string $id
  8. * @property string $idHerramienta
  9. * @property number|null $cantidad
  10. * @property string|null $fechaIngreso
  11. *
  12. * @property Herramienta $idHerramienta
  13. *
  14. */
  15. class HerramientaInventario extends ModeloBase
  16. {
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public static function tableName()
  21. {
  22. return 'HerramientaInventario';
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function rules()
  28. {
  29. return [
  30. [['id'], 'required'],
  31. [['fechaIngreso','creado', 'modificado', 'eliminado'], 'safe'],
  32. [['id', 'idHerramienta'], 'string', 'max' => 36],
  33. [['cantidad'], 'number'],
  34. [['id'], 'unique'],
  35. [['idHerramienta'], 'exist', 'skipOnError' => true, 'targetClass' => Herramienta::class, 'targetAttribute' => ['idHerramienta' => 'id']],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'idHerramienta' => 'Id Herramienta',
  46. 'cantidad' => 'Cantidad',
  47. 'fechaIngreso' => 'Fecha Ingreso',
  48. 'creado' => 'Creado',
  49. 'modificado' => 'Modificado',
  50. 'eliminado' => 'Eliminado',
  51. ];
  52. }
  53. /**
  54. * Gets query for [[IdHerramienta]].
  55. *
  56. * @return \yii\db\ActiveQuery
  57. */
  58. public function getHerramienta()
  59. {
  60. return $this->hasOne(Herramienta::class, ['id' => 'idHerramienta']);
  61. }
  62. }