Inital commit
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
namespace Thelia\Command;
|
||||
|
||||
use Propel\Generator\Command\ModelBuildCommand;
|
||||
use Symfony\Component\Console\Helper\FormatterHelper;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@@ -25,7 +26,7 @@ use Symfony\Component\Filesystem\Filesystem;
|
||||
*
|
||||
* Class ModuleGenerateModelCommand
|
||||
* @package Thelia\Command
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
* @author Manuel Raynaud <manu@raynaud.io>
|
||||
*/
|
||||
class ModuleGenerateModelCommand extends BaseModuleGenerate
|
||||
{
|
||||
@@ -46,13 +47,12 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate
|
||||
"with this option generate sql file at the same time"
|
||||
)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->module = $this->formatModuleName($input->getArgument("name"));
|
||||
$this->moduleDirectory = THELIA_MODULE_DIR . DS . $this->module;
|
||||
$this->moduleDirectory = THELIA_MODULE_DIR . $this->module;
|
||||
|
||||
$fs = new Filesystem();
|
||||
|
||||
@@ -66,11 +66,13 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate
|
||||
|
||||
$this->generateModel($output);
|
||||
|
||||
$output->renderBlock(array(
|
||||
'',
|
||||
'Model generated successfuly',
|
||||
''
|
||||
), 'bg=green;fg=black');
|
||||
/** @var FormatterHelper $formatter */
|
||||
$formatter = $this->getHelper('formatter');
|
||||
$formattedBlock = $formatter->formatBlock(
|
||||
'Model generated successfully',
|
||||
'bg=green;fg=black'
|
||||
);
|
||||
$output->writeln($formattedBlock);
|
||||
|
||||
if ($input->getOption("generate-sql")) {
|
||||
$output->writeln(' ');
|
||||
@@ -80,7 +82,6 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate
|
||||
|
||||
protected function generateSql(OutputInterface $output)
|
||||
{
|
||||
|
||||
$command = $this->getApplication()->find("module:generate:sql");
|
||||
|
||||
$command->run(
|
||||
@@ -108,7 +109,7 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate
|
||||
);
|
||||
|
||||
$verifyDirectories = array(
|
||||
THELIA_MODULE_DIR . DS . "Thelia",
|
||||
THELIA_MODULE_DIR . "Thelia",
|
||||
$this->moduleDirectory . DS . "Model" . DS . "Thelia"
|
||||
);
|
||||
|
||||
@@ -117,7 +118,5 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate
|
||||
$fs->remove($directory);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user