- protected function execute(InputInterface $input, OutputInterface $output) {
- //Fetch doctrine
- $doctrine = $this->getDoctrine();
+ protected function execute(InputInterface $input, OutputInterface $output): int {
+ //Kernel object
+ $kernel = $this->getApplication()->getKernel();
+
+ //Tmp directory
+ $tmpdir = $kernel->getContainer()->getParameter('kernel.project_dir').'/var/cache/weather';
+
+ //Set tmpdir
+ //XXX: worst case scenario we have 3 files per zipcode plus daily
+ if (!is_dir($tmpdir)) {
+ try {
+ //Create dir
+ $this->filesystem->mkdir($tmpdir, 0775);
+ } catch (IOException $exception) {
+ //Display error
+ echo 'Create dir '.$exception->getPath().' failed'."\n";
+
+ //Exit with failure
+ exit(self::FAILURE);
+ }
+ }