77 lines
1.7 KiB
PHP
77 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
use common\components\Helper;
|
|
|
|
/**
|
|
* This is the model class for table "inventory_group".
|
|
*
|
|
* @property integer $id_inventory_group
|
|
* @property string $name
|
|
* @property integer $id_product_category
|
|
* @property integer $status
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
*/
|
|
class InventoryGroup extends \common\models\BaseFitnessActiveRecord
|
|
{
|
|
|
|
const STATUS_DELETED = 0;
|
|
const STATUS_ACTIVE = 10;
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'inventory_group';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['id_product_category', 'status'], 'integer'],
|
|
[['name'], 'string', 'max' => 255]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id_inventory_group' => Yii::t('common/inventory_group', 'Leltár cs. azon.'),
|
|
'name' => Yii::t('common/inventory_group', 'Név'),
|
|
'id_product_category' => Yii::t('common/inventory_group', 'Termék kategória'),
|
|
'status' => Yii::t('common/inventory_group', 'Státusz'),
|
|
'created_at' => Yii::t('common/inventory_group', 'Létrehozva'),
|
|
];
|
|
}
|
|
|
|
public function getProductCategory( ) {
|
|
return $this->hasOne(ProductCategory::className(),[ "id_product_category" => "id_product_category" ]);
|
|
}
|
|
|
|
|
|
public function getProductCategoryName( ) {
|
|
$result = "";
|
|
$cat = $this->productCategory;
|
|
|
|
if ( isset($cat)){
|
|
$result = $cat->name;
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
}
|