Herramienta.php 2.0 KB

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