Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Cli adapter, fix jobRepository and tests.
- Loading branch information
Showing
8 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
core/ingesting/src/PublicJob/Adapter/Cli/IngestingJobCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Ingesting\PublicJob\Adapter\Cli; | ||
|
||
use Ingesting\PublicJob\Application\Usecase\JobRssDataSourceChecker; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
class IngestingJobCommand extends Command | ||
{ | ||
protected static $defaultName = 'app:ingesting:job'; | ||
|
||
protected static string $defaultDescription = 'Download rss from Gazzetta Ufficiale'; | ||
|
||
private JobRssDataSourceChecker $usecase; | ||
|
||
public function __construct(JobRssDataSourceChecker $usecase) | ||
{ | ||
$this->usecase = $usecase; | ||
parent::__construct(); | ||
} | ||
|
||
protected function configure(): void | ||
{ | ||
$this | ||
->setDescription(self::$defaultDescription); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
try { | ||
$this->usecase->readJobRssDataSource(); | ||
$io->success('You have a new command! Now make it your own! Pass --help to see your options.'); | ||
} catch (\Exception $exception) { | ||
$io->error($exception->getMessage()); | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# This file is the entry point to configure your own services. | ||
# Files in the packages/ subdirectory configure your dependencies. | ||
|
||
# Put parameters here that don't need to change on each machine where the app is deployed | ||
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration | ||
parameters: | ||
|
||
services: | ||
# default configuration for services in *this* file | ||
_defaults: | ||
autowire: true # Automatically injects dependencies in your services. | ||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. | ||
|
||
# makes classes in src/ available to be used as services | ||
# this creates a service per class whose id is the fully-qualified class name | ||
App\: | ||
resource: '../src/' | ||
exclude: | ||
- '../src/DependencyInjection/' | ||
- '../src/Entity/' | ||
- '../src/Kernel.php' | ||
- '../src/Tests/' | ||
|
||
# controllers are imported separately to make sure services can be injected | ||
# as action arguments even if you don't extend any base controller class | ||
App\Controller\: | ||
resource: '../src/Controller/' | ||
tags: ['controller.service_arguments'] | ||
|
||
# add more service definitions when explicit configuration is needed | ||
# please note that last definitions always *replace* previous ones | ||
|
||
Ingesting\PublicJob\Adapter\Persistence\Doctrine\DoctrineJobFeedRepository: | ||
public: true | ||
|
||
Ingesting\PublicJob\Infrastructure\ProductionServiceContainer: | ||
arguments: | ||
- '@Ingesting\PublicJob\Adapter\Persistence\Doctrine\DoctrineJobFeedRepository' | ||
|
||
Ingesting\PublicJob\Application\PublicJobModule: | ||
factory: [ '@Ingesting\PublicJob\Infrastructure\ProductionServiceContainer', 'module' ] | ||
public: true | ||
|
||
Ingesting\PublicJob\Adapter\Cli\IngestingJobCommand: | ||
arguments: | ||
- '@Ingesting\PublicJob\Application\PublicJobModule' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters