Stock.php 1.11 KB
<?php
    
    namespace common\modules\product\models;
    
    use Yii;
    use yii\db\ActiveRecord;
    
    /**
     * This is the model class for table "stock".
     * @property integer $stock_id
     * @property string $title
     * @property ProductStock[] $productStocks
     */
    class Stock extends ActiveRecord
    {
        
        /**
         * @inheritdoc
         */
        public static function tableName()
        {
            return 'stock';
        }
        
        /**
         * @inheritdoc
         */
        public function rules()
        {
            return [
                [
                    [ 'title' ],
                    'string',
                    'max' => 150,
                ],
                [
                    [ 'title' ],
                    'required',
                ],
            ];
        }
        
        /**
         * @inheritdoc
         */
        public function attributeLabels()
        {
            return [
                'stock_id' => Yii::t('product', 'Stock ID'),
                'title'     => Yii::t('product', 'Name'),
            ];
        }
    }