Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed config file extensions to yaml #2

Merged
merged 1 commit into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Command/BaseGenerateBundleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function configure()
new InputOption('namespace', '', InputOption::VALUE_REQUIRED, 'The namespace of the bundle to create'),
new InputOption('dir', '', InputOption::VALUE_REQUIRED, 'The directory where to create the bundle', 'bundles/'),
new InputOption('bundle-name', '', InputOption::VALUE_REQUIRED, 'The optional bundle name'),
new InputOption('format', '', InputOption::VALUE_REQUIRED, 'Use the format for configuration files (php, xml, yml, or annotation)'),
new InputOption('format', '', InputOption::VALUE_REQUIRED, 'Use the format for configuration files (php, xml, yaml, or annotation)'),
new InputOption('shared', '', InputOption::VALUE_NONE, 'Are you planning on sharing this bundle across multiple applications?'),
])
->setHelp(<<<EOT
Expand Down Expand Up @@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$runner($this->updateRouting($bundle), false);

if (!$bundle->shouldGenerateDependencyInjectionDirectory()) {
// we need to import their services.yml manually!
// we need to import their services.yaml manually!
$runner($this->updateConfiguration($output, $bundle));
}

Expand Down Expand Up @@ -254,13 +254,13 @@ protected function interact(InputInterface $input, OutputInterface $output)
]);

$question = new Question($questionHelper->getQuestion(
'Configuration format (annotation, yml, xml, php)',
'Configuration format (annotation, yaml, xml, php)',
$format
), $format);
$question->setValidator(function ($format) {
return Validators::validateFormat($format);
});
$question->setAutocompleterValues(['annotation', 'yml', 'xml', 'php']);
$question->setAutocompleterValues(['annotation', 'yaml', 'xml', 'php']);
$format = $questionHelper->ask($input, $output, $question);
$input->setOption('format', $format);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Command/Validators.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ public static function validateFormat($format)
$format = strtolower($format);

// in case they typed "yaml", but ok with that
if ($format == 'yaml') {
$format = 'yml';
if ($format == 'yml') {
$format = 'yaml';
}

if (!in_array($format, ['php', 'xml', 'yml', 'annotation'])) {
if (!in_array($format, ['php', 'xml', 'yaml', 'annotation'])) {
throw new \RuntimeException(sprintf('Format "%s" is not supported.', $format));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public function load(array $configs, ContainerBuilder $container)
new FileLocator(__DIR__ . '/../Resources/config')
);

$loader->load('services.yml');
$loader->load('services.yaml');
}
}
2 changes: 1 addition & 1 deletion src/Generator/BaseBundleGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function generateBundle(Bundle $bundle)
$this->renderFile('bundle/DefaultController.php.twig', $dir.'/Controller/DefaultController.php', $parameters);
$this->renderFile('bundle/DefaultControllerTest.php.twig', $bundle->getTestsDirectory().'/Controller/DefaultControllerTest.php', $parameters);

// render the services.yml/xml file
// render the services.yaml/xml file
$servicesFilename = $bundle->getServicesConfigurationFilename();
$this->renderFile(
sprintf('bundle/%s.twig', $servicesFilename),
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/BundleGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function generateBundle(Bundle $bundle)
'extension_alias' => $bundle->getExtensionAlias(),
];

$routingFilename = $bundle->getRoutingConfigurationFilename() ?: 'routes.yml';
$routingFilename = $bundle->getRoutingConfigurationFilename() ?: 'routing.yaml';
$routingTarget = $dir . '/Resources/config/pimcore/' . $routingFilename;

// create routing file for default annotation
Expand Down
8 changes: 4 additions & 4 deletions src/Model/BaseBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@ public function shouldGenerateDependencyInjectionDirectory()
}

/**
* What is the filename for the services.yml/xml file?
* What is the filename for the services.yaml/xml file?
*
* @return string
*/
public function getServicesConfigurationFilename()
{
if ('yml' === $this->getConfigurationFormat() || 'annotation' === $this->configurationFormat) {
return 'services.yml';
if ('yaml' === $this->getConfigurationFormat() || 'annotation' === $this->configurationFormat) {
return 'services.yaml';
} else {
return 'services.'.$this->getConfigurationFormat();
}
}

/**
* What is the filename for the routing.yml/xml file?
* What is the filename for the routing.yaml/xml file?
*
* If false, no routing file will be generated
*
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/Resources/skeleton/bundle/Extension.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class {{ bundle_basename }}Extension extends Extension
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

{% if format == 'yml' or format == 'annotation' -%}
{% if format == 'yaml' or format == 'annotation' -%}
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$loader->load('services.yaml');
{%- elseif format == 'xml' -%}
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
Expand Down