Skip to content

Commit 484ed6d

Browse files
committed
* Add possibility to save exceptions in file
1 parent bcd77f9 commit 484ed6d

File tree

7 files changed

+9
-13
lines changed

7 files changed

+9
-13
lines changed

src/Command/JobShowCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use CodeRhapsodie\DataflowBundle\Entity\Job;
88
use CodeRhapsodie\DataflowBundle\Factory\ConnectionFactory;
99
use CodeRhapsodie\DataflowBundle\Gateway\JobGateway;
10-
use CodeRhapsodie\DataflowBundle\Repository\JobRepository;
1110
use Symfony\Component\Console\Attribute\AsCommand;
1211
use Symfony\Component\Console\Command\Command;
1312
use Symfony\Component\Console\Input\InputInterface;

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function getConfigTreeBuilder(): TreeBuilder
4747
->scalarNode('flysystem_service')
4848
->end()
4949
->validate()
50-
->ifTrue(static fn($v): bool => 'file' === $v['type'] && !interface_exists('\League\Flysystem\Filesystem'))
50+
->ifTrue(static fn ($v): bool => $v['type'] === 'file' && !interface_exists('\League\Flysystem\Filesystem'))
5151
->thenInvalid('You need "league/flysystem" to use Dataflow file exception mode.')
5252
->end()
5353
->end()

src/ExceptionsHandler/ExceptionHandlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ interface ExceptionHandlerInterface
99
public function save(?int $jobId, ?array $exceptions): void;
1010

1111
public function find(int $jobId): ?array;
12-
}
12+
}

src/ExceptionsHandler/FilesystemExceptionHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ public function save(?int $jobId, ?array $exceptions): void
1919
return;
2020
}
2121

22-
$this->filesystem->write(sprintf('dataflow-job-%s.log', $jobId), json_encode($exceptions));
22+
$this->filesystem->write(\sprintf('dataflow-job-%s.log', $jobId), json_encode($exceptions));
2323
}
2424

2525
public function find(int $jobId): ?array
2626
{
2727
try {
28-
if (!$this->filesystem->has(sprintf('dataflow-job-%s.log', $jobId))) {
28+
if (!$this->filesystem->has(\sprintf('dataflow-job-%s.log', $jobId))) {
2929
return [];
3030
}
3131

32-
return json_decode($this->filesystem->read(sprintf('dataflow-job-%s.log', $jobId)), true);
32+
return json_decode($this->filesystem->read(\sprintf('dataflow-job-%s.log', $jobId)), true);
3333
} catch (FilesystemException) {
3434
return [];
3535
}
3636
}
37-
}
37+
}

src/ExceptionsHandler/NullExceptionHandler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class NullExceptionHandler implements ExceptionHandlerInterface
88
{
9-
109
public function save(?int $jobId, ?array $exceptions): void
1110
{
1211
}
@@ -15,4 +14,4 @@ public function find(int $jobId): ?array
1514
{
1615
return null;
1716
}
18-
}
17+
}

src/Gateway/JobGateway.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ private function loadExceptions(?Job $job): ?Job
4949

5050
return $job->setExceptions($this->exceptionHandler->find($job->getId()));
5151
}
52-
}
52+
}

src/Processor/JobProcessor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use CodeRhapsodie\DataflowBundle\Logger\DelegatingLogger;
1515
use CodeRhapsodie\DataflowBundle\Registry\DataflowTypeRegistryInterface;
1616
use CodeRhapsodie\DataflowBundle\Repository\JobRepository;
17-
use League\Flysystem\Filesystem;
1817
use Monolog\Logger;
1918
use Psr\Log\LoggerAwareInterface;
2019
use Psr\Log\LoggerAwareTrait;
@@ -29,8 +28,7 @@ public function __construct(
2928
private DataflowTypeRegistryInterface $registry,
3029
private EventDispatcherInterface $dispatcher,
3130
private JobGateway $jobGateway,
32-
)
33-
{
31+
) {
3432
}
3533

3634
public function process(Job $job): void

0 commit comments

Comments
 (0)