1 | <?php |
||
16 | class SpreadsheetReader extends FileIteratorReader |
||
17 | { |
||
18 | /** @var AttributeRepositoryInterface */ |
||
19 | protected $attributeRepository; |
||
20 | |||
21 | /** @var string */ |
||
22 | protected $identifierCode; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | * |
||
27 | * @Assert\NotBlank(groups={"Execution"}) |
||
28 | * @AssertFile( |
||
29 | * groups={"Execution"}, |
||
30 | * allowedExtensions={"xlsx", "xlsm", "csv"}, |
||
31 | * ) |
||
32 | */ |
||
33 | protected $filePath; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | * |
||
38 | * @Assert\NotBlank |
||
39 | * @Assert\Choice(choices={",", ";", "|"}, message="The value must be one of , or ; or |") |
||
40 | */ |
||
41 | protected $delimiter = ';'; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | * |
||
46 | * @Assert\NotBlank |
||
47 | * @Assert\Choice(choices={"""", "'"}, message="The value must be one of "" or '") |
||
48 | */ |
||
49 | protected $enclosure = '"'; |
||
50 | |||
51 | /** |
||
52 | * @var string |
||
53 | * |
||
54 | * @Assert\NotBlank |
||
55 | */ |
||
56 | protected $escape = '\\'; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | * |
||
61 | * @Assert\NotBlank |
||
62 | */ |
||
63 | protected $encoding = 'UTF8'; |
||
64 | |||
65 | /** |
||
66 | * @param AttributeRepositoryInterface $attributeRepository |
||
67 | */ |
||
68 | public function setAttributeRepository(AttributeRepositoryInterface $attributeRepository) |
||
72 | |||
73 | /** |
||
74 | * @return array |
||
75 | */ |
||
76 | public function getUploadedFileConstraints() |
||
87 | |||
88 | |||
89 | /** |
||
90 | * @param string $delimiter |
||
91 | * |
||
92 | * @return SpreadsheetReader |
||
93 | */ |
||
94 | public function setDelimiter($delimiter) |
||
100 | |||
101 | /** |
||
102 | * @return string $delimiter |
||
103 | */ |
||
104 | public function getDelimiter() |
||
108 | |||
109 | /** |
||
110 | * @param string $enclosure |
||
111 | * |
||
112 | * @return SpreadsheetReader |
||
113 | */ |
||
114 | public function setEnclosure($enclosure) |
||
120 | |||
121 | /** |
||
122 | * @return string $enclosure |
||
123 | */ |
||
124 | public function getEnclosure() |
||
128 | |||
129 | /** |
||
130 | * @param string $escape |
||
131 | * |
||
132 | * @return SpreadsheetReader |
||
133 | */ |
||
134 | public function setEscape($escape) |
||
140 | |||
141 | /** |
||
142 | * @return string $escape |
||
143 | */ |
||
144 | public function getEscape() |
||
148 | |||
149 | /** |
||
150 | * @return string |
||
151 | */ |
||
152 | public function getEncoding() |
||
156 | |||
157 | /** |
||
158 | * @param string $encoding |
||
159 | * |
||
160 | * @return SpreadsheetReader |
||
161 | */ |
||
162 | public function setEncoding($encoding) |
||
168 | |||
169 | /** |
||
170 | * {@inheritdoc} |
||
171 | */ |
||
172 | public function getConfigurationFields() |
||
214 | |||
215 | /** |
||
216 | * Returns the extension of the read file |
||
217 | * |
||
218 | * @return string |
||
219 | */ |
||
220 | protected function getExtension() |
||
224 | |||
225 | /** |
||
226 | * {@inheritdoc} |
||
227 | */ |
||
228 | protected function getIteratorOptions() |
||
242 | |||
243 | /** |
||
244 | * {@inheritdoc} |
||
245 | */ |
||
246 | protected function convertNumericIdentifierToString(array $item) |
||
256 | |||
257 | /** |
||
258 | * @return string |
||
259 | */ |
||
260 | protected function getIdentifierCode() |
||
268 | } |
||
269 |