-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #413 from tip-top-b/fixes
Fixes on the current version.
- Loading branch information
Showing
25 changed files
with
300 additions
and
134 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
47 changes: 47 additions & 0 deletions
47
src/DataDefinitionsBundle/Command/ConvertExportDefinitionsToYaml.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,47 @@ | ||
<?php | ||
|
||
namespace Instride\Bundle\DataDefinitionsBundle\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Yaml\Yaml; | ||
|
||
class ConvertExportDefinitionsToYaml extends Command | ||
{ | ||
|
||
protected function configure(): void | ||
{ | ||
$this | ||
->setName('data-definition:configuration:exporter:convert-to-yaml') | ||
->setDescription('Convert export definitions file to YAML files') | ||
->setHelp('This command converts export definitions file to YAML') | ||
->addArgument('file', InputArgument::OPTIONAL, 'Path to the PHP file', 'var/config/exportdefinitions.php'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$filePath = $input->getArgument('file'); | ||
$data = require $filePath; | ||
|
||
foreach ($data as $entry) { | ||
|
||
$fileName = $entry['id'] . '.yaml'; | ||
|
||
$yamlData = [ | ||
'data_definitions' => [ | ||
'export_definitions' => [ | ||
$entry['id'] => $entry | ||
] | ||
] | ||
]; | ||
|
||
$yaml = Yaml::dump($yamlData, 4, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK); | ||
file_put_contents("var/config/export-definitions/{$fileName}", $yaml); | ||
} | ||
$output->writeln('YAML export definitions are generated under: var/config/export-definitions'); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/DataDefinitionsBundle/Command/ConvertImportDefinitionsToYaml.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,46 @@ | ||
<?php | ||
|
||
namespace Instride\Bundle\DataDefinitionsBundle\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Yaml\Yaml; | ||
|
||
class ConvertImportDefinitionsToYaml extends Command | ||
{ | ||
|
||
protected function configure(): void | ||
{ | ||
$this->setName('data-definition:configuration:importer:convert-to-yaml') | ||
->setDescription('Convert convert import file definitions to YAML files') | ||
->setHelp('This command converts convert import file definitions file to YAML files') | ||
->addArgument('file', InputArgument::OPTIONAL, 'Path to the PHP file', 'var/config/importdefinitions.php'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$filePath = $input->getArgument('file'); | ||
$data = require $filePath; | ||
|
||
foreach ($data as $entry) { | ||
|
||
$fileName = $entry['id'] . '.yaml'; | ||
$yamlData = [ | ||
'data_definitions' => [ | ||
'import_definitions' => [ | ||
$entry['id'] => $entry | ||
] | ||
] | ||
]; | ||
|
||
$yaml = Yaml::dump($yamlData, 4, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK); | ||
|
||
file_put_contents("var/config/import-definitions/{$fileName}", $yaml); | ||
} | ||
$output->writeln('YAML import definitions configurations are generated under: var/config/import-definitions'); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
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
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
Oops, something went wrong.