This repository was archived by the owner on Dec 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.php
More file actions
61 lines (54 loc) · 1.97 KB
/
bootstrap.php
File metadata and controls
61 lines (54 loc) · 1.97 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
use Leadvertex\Plugin\Components\Batch\BatchContainer;
use Leadvertex\Plugin\Components\Db\Components\Connector;
use Leadvertex\Plugin\Components\Info\Developer;
use Leadvertex\Plugin\Components\Info\Info;
use Leadvertex\Plugin\Components\Info\PluginType;
use Leadvertex\Plugin\Components\Purpose\PluginClass;
use Leadvertex\Plugin\Components\Purpose\PluginEntity;
use Leadvertex\Plugin\Components\Purpose\PluginPurpose;
use Leadvertex\Plugin\Components\Settings\Settings;
use Leadvertex\Plugin\Components\Translations\Translator;
use Leadvertex\Plugin\Instance\Excel\ExcelHandler;
use Leadvertex\Plugin\Instance\Excel\Forms\BatchForm_1;
use Leadvertex\Plugin\Instance\Excel\Forms\SettingsForm;
use Medoo\Medoo;
use XAKEPEHOK\Path\Path;
require_once __DIR__ . '/vendor/autoload.php';
# 1. Configure DB (for SQLite *.db file and parent directory should be writable)
Connector::config(new Medoo([
'database_type' => $_ENV['DATABASE_TYPE'],
'server' => $_ENV['DATABASE_SERVER'],
'database_name' => $_ENV['DATABASE_NAME'],
'username' => $_ENV['DATABASE_USER'],
'password' => $_ENV['DATABASE_PASS']
]));
# 2. Set plugin default language
Translator::config('ru_RU');
# 3. Configure info about plugin
Info::config(
new PluginType(PluginType::MACROS),
fn() => Translator::get('info', 'Excel'),
fn() => Translator::get('info', 'Позволяет осуществлять выгрузку заказов в Excel'),
new PluginPurpose(
new PluginClass(PluginClass::CLASS_EXPORTER),
new PluginEntity(PluginEntity::ENTITY_ORDER)
),
new Developer(
'LeadVertex',
'support@leadvertex.com',
'leadvertex.com',
)
);
# 4. Configure settings form
Settings::setForm(fn() => new SettingsForm());
# 6. Configure batch forms and handler
BatchContainer::config(
function (int $number) {
switch ($number) {
case 1: return new BatchForm_1();
default: return null;
}
},
new ExcelHandler()
);