public function execute(InputInterface $input, OutputInterface $output) { $options = array('no_backup' => $input->getOption('no_backup'), 'allow_duplicate' => $input->getOption('allow_duplicate')); $logger = new Logger('WriteMetasFromXML'); $logger->pushHandler(new OutputHandler($output)); $database = new Database(array('path' => __DIR__ . '/../../../ressource/db/WriteMetasFromXML.sqlite', 'driver' => 'pdo_sqlite'), new Doctrine\DBAL\Configuration()); $config = new Config(__DIR__ . '/../../../ressource/config/WriteMetasFromXML.config.yml'); $blender = new Process\WriteMetasFromXML($config, $database, $logger, new ParameterBag($options)); $blender->blend($input->getOption('input_dir'), $input->getOption('output_dir')); }
protected function setUp() { $output = new ConsoleOutput(); $logger = new Logger('WriteMetasFromXML'); $logger->pushHandler(new OutputHandler($output)); $options = array('no_backup' => false, 'allow_duplicate' => false); self::$filesystem->remove(__DIR__ . '/../../ressources/blender.sqlite'); self::$filesystem->remove(glob(__DIR__ . "/../../ressources/output/*.jpg")); self::$filesystem->remove(__DIR__ . '/../../ressources/tmp'); $database = new Database(array('path' => __DIR__ . '/../../ressources/blender.sqlite', 'driver' => 'pdo_sqlite'), new Configuration()); $config = new Config(__DIR__ . '/../../ressources/jir.config.yml'); $process = new Process\WriteMetasFromXML($config, $database, $logger, new ParameterBag($options)); $tmpPath = __DIR__ . '/../../ressources/tmp'; $process->setTempFolder($tmpPath . '/copy'); $process->setLogFolder($tmpPath . '/log'); $process->setBackupFolder($tmpPath . '/backup'); $this->process = $process; }