|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Minubo\Business; |
|
9
|
|
|
|
|
10
|
|
|
use Spryker\Zed\Kernel\Business\AbstractBusinessFactory; |
|
11
|
|
|
use SprykerEco\Zed\Minubo\Business\DataExpander\OrderItemStateFlagExpander; |
|
12
|
|
|
use SprykerEco\Zed\Minubo\Business\DataExpander\OrderItemStateFlagExpanderInterface; |
|
13
|
|
|
use SprykerEco\Zed\Minubo\Business\Exporter\CustomerDataExporter; |
|
14
|
|
|
use SprykerEco\Zed\Minubo\Business\Exporter\DataExporterInterface; |
|
15
|
|
|
use SprykerEco\Zed\Minubo\Business\Exporter\Exporter; |
|
16
|
|
|
use SprykerEco\Zed\Minubo\Business\Exporter\ExporterInterface; |
|
17
|
|
|
use SprykerEco\Zed\Minubo\Business\Exporter\OrderDataExporter; |
|
18
|
|
|
use SprykerEco\Zed\Minubo\Business\Writer\FileWriter; |
|
19
|
|
|
use SprykerEco\Zed\Minubo\Business\Writer\WriterInterface; |
|
20
|
|
|
use SprykerEco\Zed\Minubo\MinuboDependencyProvider; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @method \SprykerEco\Zed\Minubo\MinuboConfig getConfig() |
|
24
|
|
|
* @method \SprykerEco\Zed\Minubo\Persistence\MinuboEntityManagerInterface getEntityManager() |
|
25
|
|
|
* @method \SprykerEco\Zed\Minubo\Persistence\MinuboRepositoryInterface getRepository() |
|
26
|
|
|
*/ |
|
27
|
|
|
class MinuboBusinessFactory extends AbstractBusinessFactory |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* @return \SprykerEco\Zed\Minubo\Business\Exporter\ExporterInterface |
|
31
|
|
|
*/ |
|
32
|
|
|
public function createDataExporter(): ExporterInterface |
|
33
|
|
|
{ |
|
34
|
|
|
return new Exporter( |
|
35
|
|
|
$this->getEntityManager(), |
|
36
|
|
|
$this->getExportPlugins() |
|
37
|
|
|
); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @return \SprykerEco\Zed\Minubo\Business\Exporter\DataExporterInterface |
|
42
|
|
|
*/ |
|
43
|
|
|
public function createCustomerDataExporter(): DataExporterInterface |
|
44
|
|
|
{ |
|
45
|
|
|
return new CustomerDataExporter( |
|
46
|
|
|
$this->getRepository(), |
|
47
|
|
|
$this->getCustomerDataFilterPlugins(), |
|
48
|
|
|
$this->getCustomerDataExpandPlugins(), |
|
49
|
|
|
$this->createFileWriter() |
|
50
|
|
|
); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @return \SprykerEco\Zed\Minubo\Business\Exporter\DataExporterInterface |
|
55
|
|
|
*/ |
|
56
|
|
|
public function createOrderDataExporter(): DataExporterInterface |
|
57
|
|
|
{ |
|
58
|
|
|
return new OrderDataExporter( |
|
59
|
|
|
$this->getRepository(), |
|
60
|
|
|
$this->getOrderDataFilterPlugins(), |
|
61
|
|
|
$this->getOrderDataExpandPlugins(), |
|
62
|
|
|
$this->createFileWriter() |
|
63
|
|
|
); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return \SprykerEco\Zed\Minubo\Business\Writer\WriterInterface |
|
68
|
|
|
*/ |
|
69
|
|
|
public function createFileWriter(): WriterInterface |
|
70
|
|
|
{ |
|
71
|
|
|
return new FileWriter( |
|
72
|
|
|
$this->getUtilEncodingService(), |
|
73
|
|
|
$this->getFileSystemService(), |
|
74
|
|
|
$this->getConfig() |
|
75
|
|
|
); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @return \SprykerEco\Zed\Minubo\Business\DataExpander\OrderItemStateFlagExpanderInterface |
|
80
|
|
|
*/ |
|
81
|
|
|
public function createOrderItemStateFlagExpander(): OrderItemStateFlagExpanderInterface |
|
82
|
|
|
{ |
|
83
|
|
|
return new OrderItemStateFlagExpander($this->getOmsFacade()); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboExportPluginInterface[] |
|
88
|
|
|
*/ |
|
89
|
|
|
protected function getExportPlugins() |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_EXPORT_PLUGINS_STACK); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface[] |
|
96
|
|
|
*/ |
|
97
|
|
|
protected function getCustomerDataFilterPlugins() |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_CUSTOMER_DATA_FILTER_PLUGINS_STACK); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataFilterInterface[] |
|
104
|
|
|
*/ |
|
105
|
|
|
protected function getOrderDataFilterPlugins() |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_ORDER_DATA_FILTER_PLUGINS_STACK); |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface[] |
|
112
|
|
|
*/ |
|
113
|
|
|
protected function getCustomerDataExpandPlugins() |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_CUSTOMER_DATA_EXPANDER_PLUGINS_STACK); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Plugin\MinuboDataExpanderInterface[] |
|
120
|
|
|
*/ |
|
121
|
|
|
protected function getOrderDataExpandPlugins() |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::MINUBO_ORDER_DATA_EXPANDER_PLUGINS_STACK); |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Service\MinuboToUtilEncodingServiceInterface |
|
128
|
|
|
*/ |
|
129
|
|
|
protected function getUtilEncodingService() |
|
130
|
|
|
{ |
|
131
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::SERVICE_UTIL_ENCODING); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Service\MinuboToFileSystemServiceInterface |
|
136
|
|
|
*/ |
|
137
|
|
|
protected function getFileSystemService() |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::SERVICE_FILE_SYSTEM); |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @return \SprykerEco\Zed\Minubo\Dependency\Facade\MinuboToOmsFacadeInterface |
|
144
|
|
|
*/ |
|
145
|
|
|
protected function getOmsFacade() |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->getProvidedDependency(MinuboDependencyProvider::FACADE_OMS); |
|
148
|
|
|
} |
|
149
|
|
|
} |
|
150
|
|
|
|