12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace app\models\entity;
- /**
- * This is the model class for table "tmc_storage".
- *
- * @property int $id
- * @property string $title
- * @property int $company
- * @property int $warehouse
- * @property int $stack
- * @property int $cell
- * @property int $tmc
- */
- class Storage extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'tmc_storage';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['company', 'warehouse', 'stack', 'cell', 'tmc'], 'integer'],
- [['title'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'title' => 'Title',
- 'company' => 'ID company',
- 'warehouse' => 'ID warehouse',
- 'stack' => 'ID stack',
- 'cell' => 'ID cell',
- 'tmc' => 'ID tmc',
- ];
- }
- public function toFormTitle()
- {
- return $this->company . '.' . $this->getWarehouse()->number . '.' . $this->getStack()->number . '.' . $this->cell;
- }
- public function getCompany()
- {
- return $this->hasOne(Companies::class, ['id' => 'company']);
- }
- public function getWarehouse()
- {
- return Warehouse::findOne($this->warehouse);
- }
- public function getStack()
- {
- return Stack::findOne($this->stack);
- }
- public function getCell()
- {
- return $this->hasOne(Cell::class, ['id' => 'cell']);
- }
- public function getTmc()
- {
- return $this->hasOne(Tmc::class, ['id' => 'tmc']);
- }
- }
|