77use Devim \Component \DataImporter \Exception \BadPersistsData ;
88use Devim \Component \DataImporter \Exception \EntityManagerIsClosed ;
99use Devim \Component \DataImporter \Exception \UnexpectedTypeException ;
10+ use Devim \Component \DataImporter \ExceptionHandler \ImportExceptionHandlerInterface ;
11+ use Devim \Component \DataImporter \ExceptionHandler \LogHandler ;
1012use Devim \Component \DataImporter \Filter \FilterInterface ;
1113use Devim \Component \DataImporter \Reader \ReaderInterface ;
1214use Devim \Component \DataImporter \Writer \WriterInterface ;
13- use Devim \Component \DataImporter \ExceptionHandler \ImportExceptionHandlerInterface ;
14- use Devim \Component \DataImporter \ExceptionHandler \LogHandler ;
1515use Psr \Log \LoggerInterface ;
1616use Psr \Log \NullLogger ;
1717
@@ -139,15 +139,17 @@ public function process(ImportParameters $importParameters)
139139
140140 $ this ->doPrepare ();
141141
142+ $ time = microtime (true );
142143 $ this ->reader ->beforeRead ();
143-
144+ $ importResult -> addSelectTime ( microtime ( true ) - $ time );
144145 foreach ($ this ->reader ->read () as $ data ) {
145146 try {
146147 if (!$ this ->filterData ($ data , $ this ->beforeConvertFilterQueue )) {
147148 continue ;
148149 }
150+ $ time = microtime (true );
149151 $ convertedData = $ this ->convertData ($ data );
150-
152+ $ importResult -> addConvertTime ( microtime ( true ) - $ time );
151153 if (!$ convertedData ) {
152154 continue ;
153155 }
@@ -156,21 +158,20 @@ public function process(ImportParameters $importParameters)
156158 continue ;
157159 }
158160
161+ $ time = microtime (true );
159162 $ this ->doWriteData ($ convertedData );
160-
163+ $ importResult -> addInsertTime ( microtime ( true ) - $ time );
161164 $ importResult ->incrementSuccessCount ();
162- }
163- //Если EntityManager закрыт сделать ничего нельзя, выходим из программы
164- catch (EntityManagerIsClosed $ exception ){
165+ } //Если EntityManager закрыт сделать ничего нельзя, выходим из программы
166+ catch (EntityManagerIsClosed $ exception ) {
165167 $ this ->exceptionHandler ->handle ($ exception , $ exception ->getData ());
166168
167169 throw $ exception ;
168- }catch (BadPersistsData $ persistsDataException ){
170+ } catch (BadPersistsData $ persistsDataException ) {
169171 $ importResult ->addErrors ($ persistsDataException ->getData ());
170172
171173 $ this ->exceptionHandler ->handle ($ persistsDataException , $ persistsDataException ->getData ());
172- }
173- //Сталкивался с type error, когда в арчи кривые данные лежали при convertData
174+ } //Сталкивался с type error, когда в арчи кривые данные лежали при convertData
174175 catch (\Throwable $ e ) {
175176 $ importResult ->addErrors ([$ data ]);
176177
@@ -182,11 +183,11 @@ public function process(ImportParameters $importParameters)
182183
183184 try {
184185 $ this ->doFinish ();
185- }catch (EntityManagerIsClosed $ exception ){
186+ } catch (EntityManagerIsClosed $ exception ) {
186187 $ this ->exceptionHandler ->handle ($ exception , $ exception ->getData ());
187188
188189 throw $ exception ;
189- }catch (BadPersistsData $ exception ){
190+ } catch (BadPersistsData $ exception ) {
190191 $ this ->exceptionHandler ->handle ($ exception , $ exception ->getData ());
191192 $ importResult ->addErrors ($ exception ->getData ());
192193 }
0 commit comments