5 * Contains \Drupal\Console\Command\Config\ValidateCommand.
8 namespace Drupal\Console\Command\Config;
10 use Symfony\Component\Console\Input\InputInterface;
11 use Symfony\Component\Console\Output\OutputInterface;
12 use Drupal\Console\Core\Command\ContainerAwareCommand;
13 use Drupal\Core\Config\TypedConfigManagerInterface;
14 use Symfony\Component\Console\Input\InputArgument;
15 use Drupal\Core\Config\Schema\SchemaCheckTrait;
18 * Class ValidateCommand.
20 * @package Drupal\Console\Command\Config
22 class ValidateCommand extends ContainerAwareCommand
25 use PrintConfigValidationTrait;
30 protected function configure()
33 ->setName('config:validate')
34 ->setDescription($this->trans('commands.config.validate.description'))
37 InputArgument::REQUIRED
38 )->setAliases(['cv']);
44 protected function execute(InputInterface $input, OutputInterface $output)
47 * @var TypedConfigManagerInterface $typedConfigManager
49 $typedConfigManager = $this->get('config.typed');
51 //Test the config name and see if a schema exists, if not it will fail
52 $name = $input->getArgument('name');
53 if (!$typedConfigManager->hasConfigSchema($name)) {
54 $this->getIo()->warning($this->trans('commands.config.validate.messages.no-conf'));
58 //Get the config data from the factory
59 $configFactory = $this->get('config.factory');
60 $config_data = $configFactory->get($name)->get();
62 return $this->printResults($this->checkConfigSchema($typedConfigManager, $name, $config_data));