|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace execut\import\models\base; |
|
4
|
|
|
|
|
5
|
|
|
use Yii; |
|
6
|
|
|
use yii\db\ActiveRecord; |
|
7
|
|
|
use yii\helpers\ArrayHelper; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* This is the model class for table "import_settings". |
|
11
|
|
|
* |
|
12
|
|
|
* @property integer $id |
|
13
|
|
|
* @property string $created |
|
14
|
|
|
* @property string $updated |
|
15
|
|
|
* @property string $name |
|
16
|
|
|
* @property integer $ignored_lines |
|
17
|
|
|
* @property string $email |
|
18
|
|
|
* @property string $email_title_match |
|
19
|
|
|
* @property string $csv_delimiter_old |
|
20
|
|
|
* @property string $csv_enclosure_old |
|
21
|
|
|
* @property integer $import_files_source_id |
|
22
|
|
|
* @property integer $import_files_encoding_id |
|
23
|
|
|
* @property string $csv_enclosure |
|
24
|
|
|
* @property string $csv_delimiter |
|
25
|
|
|
* @property string $ftp_host |
|
26
|
|
|
* @property boolean $ftp_ssl |
|
27
|
|
|
* @property integer $ftp_port |
|
28
|
|
|
* @property integer $ftp_timeout |
|
29
|
|
|
* @property string $ftp_login |
|
30
|
|
|
* @property string $ftp_password |
|
31
|
|
|
* @property string $ftp_dir |
|
32
|
|
|
* @property string $ftp_file_name |
|
33
|
|
|
* @property string $site_host |
|
34
|
|
|
* @property string $site_auth_url |
|
35
|
|
|
* @property string $site_auth_method |
|
36
|
|
|
* @property string $site_login_field |
|
37
|
|
|
* @property string $site_password_field |
|
38
|
|
|
* @property string $site_other_fields |
|
39
|
|
|
* @property string $site_login |
|
40
|
|
|
* @property string $site_password |
|
41
|
|
|
* @property string $site_file_url |
|
42
|
|
|
* |
|
43
|
|
|
* @property \execut\import\models\File[] $importFiles |
|
44
|
|
|
* @property \execut\import\models\FilesEncoding $importFilesEncoding |
|
45
|
|
|
* @property \execut\import\models\FilesSource $importFilesSource |
|
46
|
|
|
* @property \execut\import\models\SettingsSheet[] $importSettingsSheets |
|
47
|
|
|
*/ |
|
48
|
|
|
class Setting extends ActiveRecord |
|
49
|
|
|
{ |
|
50
|
|
|
/** |
|
51
|
|
|
* @inheritdoc |
|
52
|
|
|
*/ |
|
53
|
|
|
public static function tableName() |
|
54
|
|
|
{ |
|
55
|
|
|
return 'import_settings'; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @inheritdoc |
|
60
|
|
|
*/ |
|
61
|
|
|
public function rules() |
|
62
|
|
|
{ |
|
63
|
|
|
return ArrayHelper::merge(parent::rules(), [ |
|
64
|
|
|
[['created', 'updated', 'is_check_mime_type'], 'safe'], |
|
65
|
|
|
[['name', 'ignored_lines', 'import_files_source_id', 'import_files_encoding_id'], 'required'], |
|
66
|
|
|
[['ignored_lines', 'import_files_source_id', 'import_files_encoding_id', 'ftp_port', 'ftp_timeout'], 'integer'], |
|
67
|
|
|
[['ftp_ssl'], 'boolean'], |
|
68
|
|
|
[['name', 'email', 'email_title_match', 'csv_enclosure', 'csv_delimiter', 'ftp_host', 'ftp_login', 'ftp_password', 'ftp_dir', 'ftp_file_name', 'site_host', 'site_auth_url', 'site_auth_method', 'site_login_field', 'site_password_field', 'site_login', 'site_password', 'site_file_url'], 'string', 'max' => 255], |
|
69
|
|
|
[['site_other_fields'], 'string', 'max' => 1000], |
|
70
|
|
|
[['import_files_encoding_id'], 'exist', 'skipOnError' => true, 'targetClass' => FilesEncoding::class, 'targetAttribute' => ['import_files_encoding_id' => 'id']], |
|
71
|
|
|
[['import_files_source_id'], 'exist', 'skipOnError' => true, 'targetClass' => FilesSource::class, 'targetAttribute' => ['import_files_source_id' => 'id']], |
|
72
|
|
|
]); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @return \yii\db\ActiveQuery |
|
77
|
|
|
*/ |
|
78
|
|
|
public function getFiles() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->hasMany(\execut\import\models\File::class, ['import_setting_id' => 'id'])->inverseOf('importSetting'); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return \yii\db\ActiveQuery |
|
85
|
|
|
*/ |
|
86
|
|
|
public function getFilesEncoding() |
|
87
|
|
|
{ |
|
88
|
|
|
return $this->hasOne(\execut\import\models\FilesEncoding::class, ['id' => 'import_files_encoding_id'])->inverseOf('settings'); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @return \yii\db\ActiveQuery |
|
93
|
|
|
*/ |
|
94
|
|
|
public function getFilesSource() |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->hasOne(\execut\import\models\FilesSource::class, ['id' => 'import_files_source_id'])->inverseOf('settings'); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @return \yii\db\ActiveQuery |
|
101
|
|
|
*/ |
|
102
|
|
|
public function getSettingsSheets() |
|
103
|
|
|
{ |
|
104
|
|
|
return $this->hasMany(\execut\import\models\SettingsSheet::class, ['import_setting_id' => 'id'])->inverseOf('setting'); |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|