From b9747e9a2cdf1e19725c54ed6f75ac1bcbf4acce Mon Sep 17 00:00:00 2001 From: remi-san Date: Tue, 24 May 2016 19:40:30 +0000 Subject: [PATCH] added a command to generate predefined hydrators --- .../PredefinedHydratorGenerationCommand.php | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/Console/PredefinedHydratorGenerationCommand.php diff --git a/src/Console/PredefinedHydratorGenerationCommand.php b/src/Console/PredefinedHydratorGenerationCommand.php new file mode 100644 index 0000000..818328d --- /dev/null +++ b/src/Console/PredefinedHydratorGenerationCommand.php @@ -0,0 +1,63 @@ +hydratorFactory = $hydratorFactory; + $this->classes = $classes; + + parent::__construct($name); + } + + /** + * Configures the command + */ + protected function configure() + { + $this->setDescription('Generates hydrators cache files'); + } + + /** + * Code executed when command invoked + * + * @param InputInterface $input + * @param OutputInterface $output + * @return void + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + foreach ($this->classes as $className) { + $output->write('Generating "' . $className . '" '); + $this->hydratorFactory->getHydratorClassName($className); + $output->writeLn('Done'); + } + } +}