@@ -23,15 +23,15 @@ |
||
| 23 | 23 | protected $validator; |
| 24 | 24 | |
| 25 | 25 | function __construct(){ |
| 26 | - $this->validator = new RecursiveValidator( |
|
| 27 | - new ExecutionContextFactory(new IdentityTranslator()), new LazyLoadingMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory() |
|
| 28 | - ); |
|
| 26 | + $this->validator = new RecursiveValidator( |
|
| 27 | + new ExecutionContextFactory(new IdentityTranslator()), new LazyLoadingMetadataFactory(new StaticMethodLoader()), new ConstraintValidatorFactory() |
|
| 28 | + ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function preSave(\Propel\Runtime\Connection\ConnectionInterface $con = null){ |
| 32 | - if(!$result = $this->validate($this->validator)){ |
|
| 33 | - throw new ValidationException($this->getValidationFailures(), "Validation error"); |
|
| 34 | - } |
|
| 35 | - return $result; |
|
| 32 | + if(!$result = $this->validate($this->validator)){ |
|
| 33 | + throw new ValidationException($this->getValidationFailures(), "Validation error"); |
|
| 34 | + } |
|
| 35 | + return $result; |
|
| 36 | 36 | } |
| 37 | 37 | } |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected function render($view, array $data = array()){
|
| 12 | 12 | |
| 13 | - $ref = new \ReflectionClass($this); |
|
| 13 | + $ref = new \ReflectionClass($this); |
|
| 14 | 14 | |
| 15 | - $tpl = (new \SplFileInfo($ref->getFileName()))->getPath() . DIRECTORY_SEPARATOR . 'tpl'; |
|
| 15 | + $tpl = (new \SplFileInfo($ref->getFileName()))->getPath() . DIRECTORY_SEPARATOR . 'tpl'; |
|
| 16 | 16 | |
| 17 | - $twig = new \Twig_Environment(new \Twig_Loader_Filesystem($tpl)); |
|
| 17 | + $twig = new \Twig_Environment(new \Twig_Loader_Filesystem($tpl)); |
|
| 18 | 18 | |
| 19 | - return $twig->render($view . '.twig', $data); |
|
| 19 | + return $twig->render($view . '.twig', $data); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | abstract public function process(); |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function setParams(array $params = array()){
|
| 31 | 31 | |
| 32 | - foreach($params as $param => $value){
|
|
| 33 | - if((new \ReflectionClass($this))->hasProperty($param) === false) |
|
| 34 | - throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class));
|
|
| 32 | + foreach($params as $param => $value){
|
|
| 33 | + if((new \ReflectionClass($this))->hasProperty($param) === false) |
|
| 34 | + throw new \Exception(sprintf("param '%s' not found in module '%s'", $param, self::class));
|
|
| 35 | 35 | |
| 36 | - $this->{$param} = $value;
|
|
| 37 | - } |
|
| 38 | - return $this; |
|
| 36 | + $this->{$param} = $value;
|
|
| 37 | + } |
|
| 38 | + return $this; |
|
| 39 | 39 | } |
| 40 | 40 | } |
@@ -27,21 +27,21 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function render($view, array $data = []){
|
| 29 | 29 | |
| 30 | - $debugbarRenderer = $this->debugbar->getJavascriptRenderer("/assets/debug_bar");
|
|
| 30 | + $debugbarRenderer = $this->debugbar->getJavascriptRenderer("/assets/debug_bar");
|
|
| 31 | 31 | |
| 32 | - $data["debugbar_Head"] = $debugbarRenderer->renderHead(); |
|
| 33 | - $data["debugbar_Body"] = $debugbarRenderer->render(); |
|
| 32 | + $data["debugbar_Head"] = $debugbarRenderer->renderHead(); |
|
| 33 | + $data["debugbar_Body"] = $debugbarRenderer->render(); |
|
| 34 | 34 | |
| 35 | - return new Response($this->twig->render($view, $data)); |
|
| 35 | + return new Response($this->twig->render($view, $data)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function setTwig(Twig_Environment $twig){
|
| 39 | - $this->twig = $twig; |
|
| 40 | - return $this; |
|
| 39 | + $this->twig = $twig; |
|
| 40 | + return $this; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function setDebugbar(StandardDebugBar $debugbar){
|
| 44 | - $this->debugbar = $debugbar; |
|
| 45 | - return $this; |
|
| 44 | + $this->debugbar = $debugbar; |
|
| 45 | + return $this; |
|
| 46 | 46 | } |
| 47 | 47 | } |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | public function get($args){ |
| 16 | 16 | |
| 17 | - $result = \App::getModule(UserList::class, [ |
|
| 18 | - "limit" => 50 |
|
| 19 | - ]); |
|
| 17 | + $result = \App::getModule(UserList::class, [ |
|
| 18 | + "limit" => 50 |
|
| 19 | + ]); |
|
| 20 | 20 | |
| 21 | - return $this->render('pages/index.html.twig', [ |
|
| 22 | - "content" => $result, |
|
| 23 | - ]); |
|
| 21 | + return $this->render('pages/index.html.twig', [ |
|
| 22 | + "content" => $result, |
|
| 23 | + ]); |
|
| 24 | 24 | } |
| 25 | 25 | } |
@@ -12,12 +12,12 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct($failures, $message = "", $code = 0, $previous = null){ |
| 14 | 14 | |
| 15 | - parent::__construct($message, $code, $previous); |
|
| 15 | + parent::__construct($message, $code, $previous); |
|
| 16 | 16 | |
| 17 | - $this->failures = $failures; |
|
| 17 | + $this->failures = $failures; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | function getFailures(){ |
| 21 | - return $this->failures; |
|
| 21 | + return $this->failures; |
|
| 22 | 22 | } |
| 23 | 23 | } |
@@ -16,25 +16,25 @@ |
||
| 16 | 16 | class SeedResetCommand extends Command{ |
| 17 | 17 | |
| 18 | 18 | protected function configure(){ |
| 19 | - $this->setName('seed:reset') |
|
| 20 | - ->setDescription('Reset all seeds data') |
|
| 21 | - ->setDefinition( |
|
| 22 | - new InputDefinition(array( |
|
| 23 | - new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
| 24 | - )) |
|
| 25 | - ); |
|
| 19 | + $this->setName('seed:reset') |
|
| 20 | + ->setDescription('Reset all seeds data') |
|
| 21 | + ->setDefinition( |
|
| 22 | + new InputDefinition(array( |
|
| 23 | + new InputOption('class', 'c', InputOption::VALUE_REQUIRED) |
|
| 24 | + )) |
|
| 25 | + ); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | protected function execute(InputInterface $input, OutputInterface $output){ |
| 29 | 29 | |
| 30 | - if(!$class = $input->getOption('class')){ |
|
| 31 | - $output->writeln("Class Model not set"); |
|
| 32 | - return; |
|
| 33 | - } |
|
| 30 | + if(!$class = $input->getOption('class')){ |
|
| 31 | + $output->writeln("Class Model not set"); |
|
| 32 | + return; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - if($class::reset()){ |
|
| 36 | - $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
| 37 | - } else |
|
| 38 | - $output->writeln("Command seed:reset fail to execute!"); |
|
| 35 | + if($class::reset()){ |
|
| 36 | + $output->writeln(sprintf("Seed %s reset success!", $class)); |
|
| 37 | + } else |
|
| 38 | + $output->writeln("Command seed:reset fail to execute!"); |
|
| 39 | 39 | } |
| 40 | 40 | } |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | class InfoCommand extends Command{ |
| 14 | 14 | |
| 15 | 15 | protected function configure(){ |
| 16 | - $this->setName('info') |
|
| 17 | - ->setDescription('Outputs \'Info about command\''); |
|
| 16 | + $this->setName('info') |
|
| 17 | + ->setDescription('Outputs \'Info about command\''); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | protected function execute(InputInterface $input, OutputInterface $output){ |
| 21 | - $output->writeln('This is frameworkless console'); |
|
| 21 | + $output->writeln('This is frameworkless console'); |
|
| 22 | 22 | } |
| 23 | 23 | } |
@@ -17,27 +17,27 @@ |
||
| 17 | 17 | class InstallCommand extends Command{ |
| 18 | 18 | |
| 19 | 19 | protected function configure(){ |
| 20 | - $this->setName('install') |
|
| 21 | - ->setDescription('Install project, up migration and seeds'); |
|
| 20 | + $this->setName('install') |
|
| 21 | + ->setDescription('Install project, up migration and seeds'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected function execute(InputInterface $input, OutputInterface $output){ |
| 25 | 25 | |
| 26 | - $command = $this->getApplication()->find('config:convert'); |
|
| 27 | - $returnCode = $command->run(new ArrayInput([ |
|
| 28 | - 'command' => 'config:convert' |
|
| 29 | - ]), $output); |
|
| 26 | + $command = $this->getApplication()->find('config:convert'); |
|
| 27 | + $returnCode = $command->run(new ArrayInput([ |
|
| 28 | + 'command' => 'config:convert' |
|
| 29 | + ]), $output); |
|
| 30 | 30 | |
| 31 | - $command = $this->getApplication()->find('packages:install'); |
|
| 32 | - $returnCode = $command->run(new ArrayInput([ |
|
| 33 | - 'command' => 'packages:install' |
|
| 34 | - ]), $output); |
|
| 31 | + $command = $this->getApplication()->find('packages:install'); |
|
| 32 | + $returnCode = $command->run(new ArrayInput([ |
|
| 33 | + 'command' => 'packages:install' |
|
| 34 | + ]), $output); |
|
| 35 | 35 | |
| 36 | - $command = $this->getApplication()->find('migration:migrate'); |
|
| 37 | - $returnCode = $command->run(new ArrayInput([ |
|
| 38 | - 'command' => 'migration:migrate' |
|
| 39 | - ]), $output); |
|
| 36 | + $command = $this->getApplication()->find('migration:migrate'); |
|
| 37 | + $returnCode = $command->run(new ArrayInput([ |
|
| 38 | + 'command' => 'migration:migrate' |
|
| 39 | + ]), $output); |
|
| 40 | 40 | |
| 41 | - $output->writeln("install completed!"); |
|
| 41 | + $output->writeln("install completed!"); |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -13,28 +13,28 @@ |
||
| 13 | 13 | class InstallPackagesCommand extends Command{ |
| 14 | 14 | |
| 15 | 15 | protected function configure(){ |
| 16 | - $this->setName('packages:install') |
|
| 17 | - ->setDescription('Install packages migration and assets'); |
|
| 16 | + $this->setName('packages:install') |
|
| 17 | + ->setDescription('Install packages migration and assets'); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | protected function execute(InputInterface $input, OutputInterface $output){ |
| 21 | - $finder = \Symfony\Component\Finder\Finder::create(); |
|
| 21 | + $finder = \Symfony\Component\Finder\Finder::create(); |
|
| 22 | 22 | |
| 23 | - $root_path = __DIR__ . "../../../.."; |
|
| 23 | + $root_path = __DIR__ . "../../../.."; |
|
| 24 | 24 | |
| 25 | - $iterator = $finder |
|
| 26 | - ->files() |
|
| 27 | - ->in($root_path . "/vendor/*/*/db"); |
|
| 25 | + $iterator = $finder |
|
| 26 | + ->files() |
|
| 27 | + ->in($root_path . "/vendor/*/*/db"); |
|
| 28 | 28 | |
| 29 | - foreach($iterator as $file){ |
|
| 29 | + foreach($iterator as $file){ |
|
| 30 | 30 | |
| 31 | - if(!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())){ |
|
| 32 | - $output->writeln(sprintf("error copy migration %s...", $file->getRelativePathname())); |
|
| 33 | - } else{ |
|
| 34 | - $output->writeln(sprintf("copy migration %s", $file->getRelativePathname())); |
|
| 35 | - } |
|
| 36 | - } |
|
| 31 | + if(!copy($file->getRealpath(), $root_path . '/db/' . $file->getRelativePathname())){ |
|
| 32 | + $output->writeln(sprintf("error copy migration %s...", $file->getRelativePathname())); |
|
| 33 | + } else{ |
|
| 34 | + $output->writeln(sprintf("copy migration %s", $file->getRelativePathname())); |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - $output->writeln("completed!"); |
|
| 38 | + $output->writeln("completed!"); |
|
| 39 | 39 | } |
| 40 | 40 | } |