123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace app\models\entity;
- use Yii;
- /**
- * This is the model class for table "tmc_stack".
- *
- * @property int $id
- * @property string $title
- * @property int $warehouse
- * @property int $number
- */
- class Stack extends \yii\db\ActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'tmc_stack';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['number', 'warehouse'], 'integer'],
- [['title'], 'string', 'max' => 255],
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'title' => 'Title',
- 'warehouse' => 'ID warehouse',
- 'number' => 'Number of warehouse',
- ];
- }
- /**
- * @return Warehouse|null
- */
- public function getWarehouse()
- {
- return Warehouse::findOne($this->warehouse);
- }
- /**
- * Формирует заголовок "1.2.3" где 1 - компания, 2 - номер склада, 3 - номер стеллажа
- *
- * @return string
- */
- public function toFormTitle()
- {
- return $this->getWarehouse()->company . '.' . $this->getWarehouse()->number . '.' . $this->number;
- }
- }
|