TmcStorage.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php /** Created by Anton on 04.03.2020. */
  2. namespace app\models\entity;
  3. /**
  4. * This is the model class for table "tmc_storage".
  5. *
  6. * @property int $id
  7. * @property string $title
  8. * @property int $company
  9. * @property int $warehouse
  10. * @property int $stack
  11. * @property int $cell
  12. * @property int $tmc
  13. */
  14. class TmcStorage extends \yii\db\ActiveRecord
  15. {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function tableName()
  20. {
  21. return 'tmc_storage';
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['company', 'warehouse', 'stack', 'cell', 'tmc'], 'integer'],
  30. [['title'], 'string', 'max' => 255],
  31. ];
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function attributeLabels()
  37. {
  38. return [
  39. 'id' => 'ID',
  40. 'title' => 'Title',
  41. 'company' => 'Company ID',
  42. 'warehouse' => 'log ID',
  43. 'stack' => 'log ID',
  44. 'cell' => 'Cell ID',
  45. 'tmc' => 'Tmc ID',
  46. ];
  47. }
  48. /**
  49. * Возвращает устройство находящееся в ячейке
  50. *
  51. * @return Tmc|null
  52. */
  53. public function getTmc()
  54. {
  55. return Tmc::findOne($this->tmc);
  56. }
  57. }