ItemLang.php
1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace frontend\modules\map\models;
use yii\helpers\ArrayHelper;
/**
* Class ItemLang
*
* @package frontend\modules\map\models
* @author FilamentV <vortex.filament@gmail.com>
* @copyright (c), Thread
*/
class ItemLang extends \common\modules\map\models\ItemLang
{
/**
* @return array
*/
public function rules()
{
return ArrayHelper::merge(parent::rules(), [
[[
'title', 'initiator', 'contact_details_of_project_promoter',
'annual_power_production', 'annual_heat_production',
'expected_financial_return', 'investment', 'description'
], 'required'],
['rid', 'exist', 'targetClass' => Item::class, 'targetAttribute' => 'id'],
['title', 'string', 'max' => 256],
[['description', 'contact_details_of_project_promoter'], 'string', 'max' => 1024],
[['description', 'contact_details_of_project_promoter', 'total_investment'], 'default', 'value' => ' '],
]);
}
/**
* @param bool $insert
* @return bool
*/
public function beforeSave($insert)
{
$this->licenses = implode(",", $_POST['ItemLang']['licenses'] ?? '');
return parent::beforeSave($insert);
}
}