protected function writeToFileFromTemplate($path, $templateName, OutputInterface $output = null, array $variables = [], $overwrite = false)
    {
        if ($overwrite || (!file_exists($path) && !is_dir($path))) {
            $dir = dirname($path);
            if (!file_exists($dir) || !is_dir($dir)) {
                mkdir($dir, 0777, true);
            }

            file_put_contents($path, $this->renderTemplate($templateName, $variables));
            $output->writeln('<info>File created:</info> ' . $path);
        } else {
            $output->writeln('<info>File already exists:</info> ' . $path . ' <comment>(Overwrite disabled)</comment>');
        }
    }
protected function writeToFileFromTemplate($path, $templateName, OutputInterface $output = null, array $variables = [], $overwrite = false)
    {
        if ($overwrite || (!file_exists($path) && !is_dir($path))) {
            $dir = dirname($path);
            if (!file_exists($dir) || !is_dir($dir)) {
                mkdir($dir, 0777, true);
            }

            file_put_contents($path, $this->renderTemplate($templateName, $variables));
            $output->writeln('<info>File created:</info> ' . $path);
        } else {
            $output->writeln('<info>File already exists:</info> ' . $path . ' <comment>(Overwrite disabled)</comment>');
        }
    }
protected function writeToFileFromTemplate ( $ path , $ templateName , OutputInterface $ output = null , array $ variables = [ ] , $ overwrite = false ) { if ( $ overwrite || ( ! file_exists ( $ path ) && ! is_dir ( $ path ) ) ) { $ dir = dirname ( $ path ) ; if ( ! file_exists ( $ dir ) || ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0777 , true ) ; } file_put_contents ( $ path , $ this -> renderTemplate ( $ templateName , $ variables ) ) ; $ output -> writeln ( '<info>File created:</info> ' . $ path ) ; } else { $ output -> writeln ( '<info>File already exists:</info> ' . $ path . ' <comment>(Overwrite disabled)</comment>' ) ; } }
Render template content and write to file

@param string                                                 $path         output relative file name
@param string                                                 $templateName source relative template file name
@param \Symfony\Component\Console\Output\OutputInterface|null $output       command line output
@param array                                                  $variables    array of template variable key value
pairs
@param bool                                                   $overwrite    if output file exists and this
option is TRUE overwrite file,
otherwise skip

@throws \ViKon\DbExporter\Exception\DbExporterException
Render template content and write to file