protected function generateModel(OutputInterface $output) { $fs = new Filesystem(); $moduleBuildPropel = new ModelBuildCommand(); $moduleBuildPropel->setApplication($this->getApplication()); $moduleBuildPropel->run(new ArrayInput(array("command" => $moduleBuildPropel->getName(), "--output-dir" => THELIA_MODULE_DIR, "--input-dir" => $this->moduleDirectory . DS . "Config")), $output); $verifyDirectories = array(THELIA_MODULE_DIR . "Thelia", $this->moduleDirectory . DS . "Model" . DS . "Thelia"); foreach ($verifyDirectories as $directory) { if ($fs->exists($directory)) { $fs->remove($directory); } } }
/** * @return string * @throws \Exception */ public function generateClasses() { $tmp = $this->getJarves()->getCacheDir() . '/'; if (!file_exists($tmp . 'propel')) { self::writeConfig(); self::writeBuildProperties(); self::collectSchemas(); } $platform = $this->getJarves()->getSystemConfig()->getDatabase()->getMainConnection()->getType(); $platform = ucfirst($platform) . 'Platform'; $input = new ArrayInput(array('--config-dir' => $tmp . 'propel/', '--schema-dir' => $tmp . 'propel/', '--output-dir' => $tmp . 'propel/build/classes/', '--platform' => $platform, '--verbose' => 'vvv')); $command = new ModelBuildCommand(); $command->getDefinition()->addOption(new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, '')); $output = new StreamOutput(fopen('php://memory', 'rw')); $command->run($input, $output); $content = stream_get_contents($output->getStream()); $content .= self::moveClasses(); return $content; }