|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This class is generated using the package carono/codegen |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace carono\exchange1c\models\base; |
|
8
|
|
|
|
|
9
|
|
|
use Yii; |
|
10
|
|
|
use yii\db\ActiveRecord; |
|
11
|
|
|
use yii\helpers\ArrayHelper; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* This is the base-model class for table "article". |
|
15
|
|
|
* |
|
16
|
|
|
* @property integer $id |
|
17
|
|
|
* @property string $name |
|
18
|
|
|
* @property integer $parent_id |
|
19
|
|
|
* @property integer $pos |
|
20
|
|
|
* @property string $content |
|
21
|
|
|
* @property string $created_at |
|
22
|
|
|
* @property string $updated_at |
|
23
|
|
|
*/ |
|
24
|
|
|
class Article extends ActiveRecord |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* @inheritdoc |
|
28
|
|
|
*/ |
|
29
|
|
|
public static function tableName() |
|
30
|
|
|
{ |
|
31
|
|
|
return '{{%article}}'; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @inheritdoc |
|
37
|
|
|
*/ |
|
38
|
|
|
public function rules() |
|
39
|
|
|
{ |
|
40
|
|
|
return [ |
|
41
|
|
|
[['name'], 'required'], |
|
42
|
|
|
[['parent_id', 'pos'], 'integer'], |
|
43
|
|
|
[['content'], 'string'], |
|
44
|
|
|
[['name'], 'string', 'max' => 255], |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @inheritdoc |
|
51
|
|
|
* @return \carono\exchange1c\models\Article|\yii\db\ActiveRecord |
|
52
|
|
|
*/ |
|
53
|
|
|
public static function findOne($condition, $raise = false) |
|
54
|
|
|
{ |
|
55
|
|
|
$model = parent::findOne($condition); |
|
56
|
|
|
if (!$model && $raise){ |
|
|
|
|
|
|
57
|
|
|
throw new \yii\web\HttpException(404, Yii::t('errors', "Model carono\\exchange1c\\models\\Article not found")); |
|
58
|
|
|
}else{ |
|
59
|
|
|
return $model; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @inheritdoc |
|
66
|
|
|
*/ |
|
67
|
|
|
public function attributeLabels() |
|
68
|
|
|
{ |
|
69
|
|
|
return [ |
|
70
|
|
|
'id' => Yii::t('models', 'ID'), |
|
71
|
|
|
'name' => Yii::t('models', 'Name'), |
|
72
|
|
|
'parent_id' => Yii::t('models', 'Parent ID'), |
|
73
|
|
|
'pos' => Yii::t('models', 'Pos'), |
|
74
|
|
|
'content' => Yii::t('models', 'Content'), |
|
75
|
|
|
'created_at' => Yii::t('models', 'Created At'), |
|
76
|
|
|
'updated_at' => Yii::t('models', 'Updated At') |
|
77
|
|
|
]; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @inheritdoc |
|
83
|
|
|
* @return \carono\exchange1c\models\query\ArticleQuery the active query used by this AR class. |
|
84
|
|
|
*/ |
|
85
|
|
|
public static function find() |
|
86
|
|
|
{ |
|
87
|
|
|
return new \carono\exchange1c\models\query\ArticleQuery(get_called_class()); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @param string $attribute |
|
93
|
|
|
* @return string|null |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getRelationClass($attribute) |
|
96
|
|
|
{ |
|
97
|
|
|
return ArrayHelper::getValue($this->_relationClasses, $attribute); |
|
|
|
|
|
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
|