13
13
use Yokai \Batch \Bridge \Doctrine \Persistence \ObjectWriter ;
14
14
use Yokai \Batch \Bridge \Symfony \Framework \JobWithStaticNameInterface ;
15
15
use Yokai \Batch \Bridge \Symfony \Validator \SkipInvalidItemProcessor ;
16
+ use Yokai \Batch \Job \AbstractDecoratedJob ;
16
17
use Yokai \Batch \Job \Item \ItemJob ;
17
18
use Yokai \Batch \Job \Item \Processor \ArrayMapProcessor ;
18
19
use Yokai \Batch \Job \Item \Processor \CallbackProcessor ;
35
36
* Writer :
36
37
* - Write processed entities to the database.
37
38
*/
38
- abstract class AbstractImportStartWarsEntityJob extends ItemJob implements JobWithStaticNameInterface
39
+ abstract class AbstractImportStartWarsEntityJob extends AbstractDecoratedJob implements JobWithStaticNameInterface
39
40
{
40
41
public function __construct (
41
42
string $ file ,
@@ -45,21 +46,23 @@ public function __construct(
45
46
JobExecutionStorageInterface $ executionStorage
46
47
) {
47
48
parent ::__construct (
48
- 50 , // could be much higher, but set this way for demo purpose
49
- new FlatFileReader (
50
- new StaticValueParameterAccessor ($ file ),
51
- new CSVOptions (),
52
- HeaderStrategy::combine ()
53
- ),
54
- new ChainProcessor ([
55
- new ArrayMapProcessor (
56
- fn (string $ value ) => $ value === 'NA ' ? null : $ value
49
+ new ItemJob (
50
+ 50 , // could be much higher, but set this way for demo purpose
51
+ new FlatFileReader (
52
+ new StaticValueParameterAccessor ($ file ),
53
+ new CSVOptions (),
54
+ HeaderStrategy::combine ()
57
55
),
58
- new CallbackProcessor ($ process ),
59
- new SkipInvalidItemProcessor ($ validator ),
60
- ]),
61
- new ObjectWriter ($ doctrine ),
62
- $ executionStorage
56
+ new ChainProcessor ([
57
+ new ArrayMapProcessor (
58
+ fn (string $ value ) => $ value === 'NA ' ? null : $ value
59
+ ),
60
+ new CallbackProcessor ($ process ),
61
+ new SkipInvalidItemProcessor ($ validator ),
62
+ ]),
63
+ new ObjectWriter ($ doctrine ),
64
+ $ executionStorage
65
+ )
63
66
);
64
67
}
65
68
}
0 commit comments