@@ -28,7 +28,7 @@  | 
                                                    ||
| 28 | 28 | $this->setDispatcher($dispatcher);  | 
                                                        
| 29 | 29 | $this->keekoDispatcher = $dispatcher;  | 
                                                        
| 30 | 30 | |
| 31 | -		$dispatcher->addListener(ConsoleEvents::TERMINATE, function (ConsoleTerminateEvent $event) { | 
                                                        |
| 31 | +		$dispatcher->addListener(ConsoleEvents::TERMINATE, function(ConsoleTerminateEvent $event) { | 
                                                        |
| 32 | 32 | $command = $event->getCommand();  | 
                                                        
| 33 | 33 | $this->finishedCommands[] = $command->getName();  | 
                                                        
| 34 | 34 | });  | 
                                                        
@@ -358,13 +358,13 @@  | 
                                                    ||
| 358 | 358 | $type = $this->getPackageType();  | 
                                                        
| 359 | 359 | |
| 360 | 360 |  		switch ($type) { | 
                                                        
| 361 | - case 'app':  | 
                                                        |
| 362 | - $this->handleAppClass($class);  | 
                                                        |
| 363 | - break;  | 
                                                        |
| 361 | + case 'app':  | 
                                                        |
| 362 | + $this->handleAppClass($class);  | 
                                                        |
| 363 | + break;  | 
                                                        |
| 364 | 364 | |
| 365 | - case 'module':  | 
                                                        |
| 366 | - $this->handleModuleClass($class);  | 
                                                        |
| 367 | - break;  | 
                                                        |
| 365 | + case 'module':  | 
                                                        |
| 366 | + $this->handleModuleClass($class);  | 
                                                        |
| 367 | + break;  | 
                                                        |
| 368 | 368 | }  | 
                                                        
| 369 | 369 | |
| 370 | 370 | $this->codegenService->dumpStruct($class, true);  | 
                                                        
@@ -123,14 +123,14 @@ discard block  | 
                                                    ||
| 123 | 123 |  			if (!empty($localName)) { | 
                                                        
| 124 | 124 | $name = $this->package->getFullName();  | 
                                                        
| 125 | 125 |  			} else if (isset($git['github.user'])) { | 
                                                        
| 126 | - $name = $git['github.user'] . '/' . $name;  | 
                                                        |
| 126 | + $name = $git['github.user'].'/'.$name;  | 
                                                        |
| 127 | 127 |  			} elseif (!empty($_SERVER['USERNAME'])) { | 
                                                        
| 128 | - $name = $_SERVER['USERNAME'] . '/' . $name;  | 
                                                        |
| 128 | + $name = $_SERVER['USERNAME'].'/'.$name;  | 
                                                        |
| 129 | 129 |  			} elseif (get_current_user()) { | 
                                                        
| 130 | - $name = get_current_user() . '/' . $name;  | 
                                                        |
| 130 | + $name = get_current_user().'/'.$name;  | 
                                                        |
| 131 | 131 |  			} else { | 
                                                        
| 132 | 132 | // package names must be in the format foo/bar  | 
                                                        
| 133 | - $name = $name . '/' . $name;  | 
                                                        |
| 133 | + $name = $name.'/'.$name;  | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | 135 |  		} else { | 
                                                        
| 136 | 136 | $this->validateName($name);  | 
                                                        
@@ -171,9 +171,9 @@ discard block  | 
                                                    ||
| 171 | 171 | $types = ['module', 'app'];  | 
                                                        
| 172 | 172 |  			$question = new Question('Package type (module|app)', $type); | 
                                                        
| 173 | 173 | $question->setAutocompleterValues($types);  | 
                                                        
| 174 | -			$question->setValidator(function ($answer) use ($types) { | 
                                                        |
| 174 | +			$question->setValidator(function($answer) use ($types) { | 
                                                        |
| 175 | 175 |  				if (!in_array($answer, $types)) { | 
                                                        
| 176 | -					throw new \RuntimeException('The name of the type should be one of: ' .  | 
                                                        |
| 176 | +					throw new \RuntimeException('The name of the type should be one of: '.  | 
                                                        |
| 177 | 177 |  							implode(',', $types)); | 
                                                        
| 178 | 178 | }  | 
                                                        
| 179 | 179 | return $answer;  | 
                                                        
@@ -204,7 +204,7 @@ discard block  | 
                                                    ||
| 204 | 204 | // KEEKO values  | 
                                                        
| 205 | 205 | $output->writeln([  | 
                                                        
| 206 | 206 | '',  | 
                                                        
| 207 | - 'Information for Keeko ' . ucfirst($type),  | 
                                                        |
| 207 | + 'Information for Keeko '.ucfirst($type),  | 
                                                        |
| 208 | 208 | ''  | 
                                                        
| 209 | 209 | ]);  | 
                                                        
| 210 | 210 | |
@@ -259,7 +259,7 @@ discard block  | 
                                                    ||
| 259 | 259 | // type  | 
                                                        
| 260 | 260 |  		if (($type = $input->getOption('type')) !== null) { | 
                                                        
| 261 | 261 |  			if (in_array($type, ['app', 'module'])) { | 
                                                        
| 262 | -				$this->package->setType('keeko-' . $type); | 
                                                        |
| 262 | +				$this->package->setType('keeko-'.$type); | 
                                                        |
| 263 | 263 | }  | 
                                                        
| 264 | 264 | }  | 
                                                        
| 265 | 265 | |
@@ -368,7 +368,7 @@ discard block  | 
                                                    ||
| 368 | 368 | $package = $this->package->getKeeko()->getKeekoPackage($type);  | 
                                                        
| 369 | 369 | $fqcn = str_replace(['\\', 'keeko-', '-module', '-app'], ['/', '', '', ''], $package->getClass());  | 
                                                        
| 370 | 370 | $classname = basename($fqcn);  | 
                                                        
| 371 | - $filename = $this->project->getRootPath() . '/src/' . $classname . '.php';  | 
                                                        |
| 371 | + $filename = $this->project->getRootPath().'/src/'.$classname.'.php';  | 
                                                        |
| 372 | 372 |  		$fqcn = str_replace('/', '\\', $fqcn); | 
                                                        
| 373 | 373 | |
| 374 | 374 |  		if (!file_exists($filename) || $input->getOption('force')) { | 
                                                        
@@ -499,7 +499,7 @@ discard block  | 
                                                    ||
| 499 | 499 |  			$parts = explode('/', $pkgName); | 
                                                        
| 500 | 500 |  			$ns = $input->getOption('namespace'); | 
                                                        
| 501 | 501 |  			$namespace = !empty($ns) ? $ns : str_replace('/', '\\', $pkgName); | 
                                                        
| 502 | - $classname = $namespace . '\\' . ucfirst($parts[1]);  | 
                                                        |
| 502 | + $classname = $namespace.'\\'.ucfirst($parts[1]);  | 
                                                        |
| 503 | 503 | |
| 504 | 504 | // suffix  | 
                                                        
| 505 | 505 |  			if ($type === 'module') { | 
                                                        
@@ -24,8 +24,7 @@  | 
                                                    ||
| 24 | 24 | */  | 
                                                        
| 25 | 25 |  	protected function getQuestion($question, $default = null, $sep = ':') { | 
                                                        
| 26 | 26 | return !empty($default) ?  | 
                                                        
| 27 | -			sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) : | 
                                                        |
| 28 | -			sprintf('<info>%s</info>%s ', $question, $sep); | 
                                                        |
| 27 | +			sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) : sprintf('<info>%s</info>%s ', $question, $sep); | 
                                                        |
| 29 | 28 | }  | 
                                                        
| 30 | 29 | |
| 31 | 30 | /**  | 
                                                        
@@ -153,14 +153,14 @@  | 
                                                    ||
| 153 | 153 | // iterate over behaviors to get their respective columns  | 
                                                        
| 154 | 154 |  		foreach ($table->getBehaviors() as $behavior) { | 
                                                        
| 155 | 155 |  			switch ($behavior->getName()) { | 
                                                        
| 156 | - case 'timestampable':  | 
                                                        |
| 157 | -					$fields[] = $behavior->getParameter('create_column'); | 
                                                        |
| 158 | -					$fields[] = $behavior->getParameter('update_column'); | 
                                                        |
| 159 | - break;  | 
                                                        |
| 160 | -  | 
                                                        |
| 161 | - case 'aggregate_column':  | 
                                                        |
| 162 | -					$fields[] = $behavior->getParameter('name'); | 
                                                        |
| 163 | - break;  | 
                                                        |
| 156 | + case 'timestampable':  | 
                                                        |
| 157 | +				$fields[] = $behavior->getParameter('create_column'); | 
                                                        |
| 158 | +				$fields[] = $behavior->getParameter('update_column'); | 
                                                        |
| 159 | + break;  | 
                                                        |
| 160 | +  | 
                                                        |
| 161 | + case 'aggregate_column':  | 
                                                        |
| 162 | +				$fields[] = $behavior->getParameter('name'); | 
                                                        |
| 163 | + break;  | 
                                                        |
| 164 | 164 | }  | 
                                                        
| 165 | 165 | }  | 
                                                        
| 166 | 166 | |
@@ -62,7 +62,7 @@  | 
                                                    ||
| 62 | 62 | * Adds authors to the docblock of the given struct  | 
                                                        
| 63 | 63 | *  | 
                                                        
| 64 | 64 | * @param AbstractPhpStruct $struct  | 
                                                        
| 65 | - * @param array $package  | 
                                                        |
| 65 | + * @param PackageSchema $package  | 
                                                        |
| 66 | 66 | */  | 
                                                        
| 67 | 67 |  	public function addAuthors(AbstractPhpStruct $struct, PackageSchema $package) { | 
                                                        
| 68 | 68 | $docblock = $struct->getDocblock();  | 
                                                        
@@ -17,7 +17,7 @@ discard block  | 
                                                    ||
| 17 | 17 | |
| 18 | 18 |  	public function getCodegenFile() { | 
                                                        
| 19 | 19 | $basepath = dirname($this->project->getComposerFileName());  | 
                                                        
| 20 | - return $basepath . '/codegen.json';  | 
                                                        |
| 20 | + return $basepath.'/codegen.json';  | 
                                                        |
| 21 | 21 | }  | 
                                                        
| 22 | 22 | |
| 23 | 23 | /**  | 
                                                        
@@ -229,7 +229,7 @@ discard block  | 
                                                    ||
| 229 | 229 | $jsonFile = $this->project->getComposerFileName();  | 
                                                        
| 230 | 230 | $path = new Path(dirname($jsonFile));  | 
                                                        
| 231 | 231 | $path = $path->append($relativeSourcePath);  | 
                                                        
| 232 | - $path = $path->append($struct->getName() . '.php');  | 
                                                        |
| 232 | + $path = $path->append($struct->getName().'.php');  | 
                                                        |
| 233 | 233 | return $path->toString();  | 
                                                        
| 234 | 234 | }  | 
                                                        
| 235 | 235 | |
@@ -91,6 +91,9 @@  | 
                                                    ||
| 91 | 91 | ;  | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | |
| 94 | + /**  | 
                                                        |
| 95 | + * @param string $name  | 
                                                        |
| 96 | + */  | 
                                                        |
| 94 | 97 |  	protected function runCommand($name, InputInterface $input, OutputInterface $output) { | 
                                                        
| 95 | 98 | // return whether command has already executed  | 
                                                        
| 96 | 99 | $app = $this->getApplication();  | 
                                                        
@@ -268,14 +268,14 @@  | 
                                                    ||
| 268 | 268 |  	private function getActionTitle($modelName, $type) { | 
                                                        
| 269 | 269 | $name = NameUtils::dasherize($modelName);  | 
                                                        
| 270 | 270 |  		switch ($type) { | 
                                                        
| 271 | - case 'list':  | 
                                                        |
| 272 | - return 'List all ' . NameUtils::pluralize($name);  | 
                                                        |
| 271 | + case 'list':  | 
                                                        |
| 272 | + return 'List all ' . NameUtils::pluralize($name);  | 
                                                        |
| 273 | 273 | |
| 274 | - case 'create':  | 
                                                        |
| 275 | - case 'read':  | 
                                                        |
| 276 | - case 'update':  | 
                                                        |
| 277 | - case 'delete':  | 
                                                        |
| 278 | - return ucfirst($type) . 's ' . (in_array($name[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a') . ' ' . $name;  | 
                                                        |
| 274 | + case 'create':  | 
                                                        |
| 275 | + case 'read':  | 
                                                        |
| 276 | + case 'update':  | 
                                                        |
| 277 | + case 'delete':  | 
                                                        |
| 278 | + return ucfirst($type) . 's ' . (in_array($name[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a') . ' ' . $name;  | 
                                                        |
| 279 | 279 | }  | 
                                                        
| 280 | 280 | }  | 
                                                        
| 281 | 281 | |
@@ -281,7 +281,6 @@ discard block  | 
                                                    ||
| 281 | 281 | /**  | 
                                                        
| 282 | 282 | * Generates an action.  | 
                                                        
| 283 | 283 | *  | 
                                                        
| 284 | - * @param string $actionName  | 
                                                        |
| 285 | 284 | * @param ActionSchema $action the action node from composer.json  | 
                                                        
| 286 | 285 | */  | 
                                                        
| 287 | 286 |  	private function generateNamed($actionName) { | 
                                                        
@@ -295,7 +294,7 @@ discard block  | 
                                                    ||
| 295 | 294 | /**  | 
                                                        
| 296 | 295 | * Generates the action for the package  | 
                                                        
| 297 | 296 | *  | 
                                                        
| 298 | - * @param unknown $actionName  | 
                                                        |
| 297 | + * @param string $actionName  | 
                                                        |
| 299 | 298 | * @throws \RuntimeException  | 
                                                        
| 300 | 299 | * @return ActionSchema  | 
                                                        
| 301 | 300 | */  | 
                                                        
@@ -183,7 +183,7 @@ discard block  | 
                                                    ||
| 183 | 183 | }  | 
                                                        
| 184 | 184 | |
| 185 | 185 |  	private function generateModel($modelName) { | 
                                                        
| 186 | -		$this->logger->info('Generate Action from Model: ' . $modelName); | 
                                                        |
| 186 | +		$this->logger->info('Generate Action from Model: '.$modelName); | 
                                                        |
| 187 | 187 | $input = $this->io->getInput();  | 
                                                        
| 188 | 188 | $model = $this->modelService->getModel($modelName);  | 
                                                        
| 189 | 189 | |
@@ -202,7 +202,7 @@ discard block  | 
                                                    ||
| 202 | 202 |  		foreach ($types as $type) { | 
                                                        
| 203 | 203 |  			$input->setOption('acl', ['admin']); | 
                                                        
| 204 | 204 |  			$input->setOption('type', $type); | 
                                                        
| 205 | - $actionName = $modelName . '-' . $type;  | 
                                                        |
| 205 | + $actionName = $modelName.'-'.$type;  | 
                                                        |
| 206 | 206 | |
| 207 | 207 |  			if ($model->isReadOnly() && in_array($type, ['create', 'update', 'delete'])) { | 
                                                        
| 208 | 208 |  				$this->logger->info(sprintf('Skip generate Action (%s), because Model (%s) is read-only', $actionName, $modelName)); | 
                                                        
@@ -246,13 +246,13 @@ discard block  | 
                                                    ||
| 246 | 246 | $name = NameUtils::dasherize($modelName);  | 
                                                        
| 247 | 247 |  		switch ($type) { | 
                                                        
| 248 | 248 | case 'list':  | 
                                                        
| 249 | - return 'List all ' . NameUtils::pluralize($name);  | 
                                                        |
| 249 | + return 'List all '.NameUtils::pluralize($name);  | 
                                                        |
| 250 | 250 | |
| 251 | 251 | case 'create':  | 
                                                        
| 252 | 252 | case 'read':  | 
                                                        
| 253 | 253 | case 'update':  | 
                                                        
| 254 | 254 | case 'delete':  | 
                                                        
| 255 | - return ucfirst($type) . 's ' . (in_array($name[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a') . ' ' . $name;  | 
                                                        |
| 255 | + return ucfirst($type).'s '.(in_array($name[0], ['a', 'e', 'i', 'o', 'u']) ? 'an' : 'a').' '.$name;  | 
                                                        |
| 256 | 256 | }  | 
                                                        
| 257 | 257 | }  | 
                                                        
| 258 | 258 | |
@@ -285,7 +285,7 @@ discard block  | 
                                                    ||
| 285 | 285 | * @param ActionSchema $action the action node from composer.json  | 
                                                        
| 286 | 286 | */  | 
                                                        
| 287 | 287 |  	private function generateNamed($actionName) { | 
                                                        
| 288 | -		$this->logger->info('Generate Action: ' . $actionName); | 
                                                        |
| 288 | +		$this->logger->info('Generate Action: '.$actionName); | 
                                                        |
| 289 | 289 | $action = $this->generateAction($actionName);  | 
                                                        
| 290 | 290 | |
| 291 | 291 | // generate code  | 
                                                        
@@ -339,7 +339,7 @@ discard block  | 
                                                    ||
| 339 | 339 | |
| 340 | 340 |  	private function guessClassname($name) { | 
                                                        
| 341 | 341 |  		$namespace = NamespaceResolver::getNamespace('src/action', $this->package); | 
                                                        
| 342 | - return $namespace . '\\' . NameUtils::toStudlyCase($name) . 'Action';  | 
                                                        |
| 342 | + return $namespace.'\\'.NameUtils::toStudlyCase($name).'Action';  | 
                                                        |
| 343 | 343 | }  | 
                                                        
| 344 | 344 | |
| 345 | 345 | /**  | 
                                                        
@@ -398,14 +398,14 @@ discard block  | 
                                                    ||
| 398 | 398 | // class  | 
                                                        
| 399 | 399 | $class = new PhpClass($action->getClass());  | 
                                                        
| 400 | 400 | $filename = $this->codegenService->getFilename($class);  | 
                                                        
| 401 | - $traitNs = $class->getNamespace() . '\\base';  | 
                                                        |
| 402 | - $traitName = $class->getName() . 'Trait';  | 
                                                        |
| 401 | + $traitNs = $class->getNamespace().'\\base';  | 
                                                        |
| 402 | + $traitName = $class->getName().'Trait';  | 
                                                        |
| 403 | 403 | $overwrite = false;  | 
                                                        
| 404 | 404 | |
| 405 | 405 | // load from file, when class exists  | 
                                                        
| 406 | 406 |  		if (file_exists($filename)) { | 
                                                        
| 407 | 407 | // load trait  | 
                                                        
| 408 | - $trait = new PhpTrait($traitNs . '\\' . $traitName);  | 
                                                        |
| 408 | + $trait = new PhpTrait($traitNs.'\\'.$traitName);  | 
                                                        |
| 409 | 409 | $traitFile = new File($this->codegenService->getFilename($trait));  | 
                                                        
| 410 | 410 | |
| 411 | 411 |  			if ($traitFile->exists()) { | 
                                                        
@@ -430,7 +430,7 @@ discard block  | 
                                                    ||
| 430 | 430 |  		if ($modelName !== null) { | 
                                                        
| 431 | 431 | $type = $this->packageService->getActionType($action->getName(), $modelName);  | 
                                                        
| 432 | 432 | $generator = GeneratorFactory::createActionTraitGenerator($type, $this->service);  | 
                                                        
| 433 | - $trait = $generator->generate($traitNs . '\\' . $traitName, $action);  | 
                                                        |
| 433 | + $trait = $generator->generate($traitNs.'\\'.$traitName, $action);  | 
                                                        |
| 434 | 434 | |
| 435 | 435 | $this->codegenService->addAuthors($trait, $this->package);  | 
                                                        
| 436 | 436 | $this->codegenService->dumpStruct($trait, true);  | 
                                                        
@@ -472,10 +472,10 @@ discard block  | 
                                                    ||
| 472 | 472 |  		foreach (array_keys($generators) as $type) { | 
                                                        
| 473 | 473 | // generate fqcn  | 
                                                        
| 474 | 474 |  			$className = sprintf('%s%s%sAction', $model->getPhpName(), $fkModelName, ucfirst($type)); | 
                                                        
| 475 | - $fqcn = $this->packageService->getNamespace() . '\\action\\' . $className;  | 
                                                        |
| 475 | + $fqcn = $this->packageService->getNamespace().'\\action\\'.$className;  | 
                                                        |
| 476 | 476 | |
| 477 | 477 | // generate action  | 
                                                        
| 478 | - $action = new ActionSchema($actionNamePrefix . '-' . $type);  | 
                                                        |
| 478 | + $action = new ActionSchema($actionNamePrefix.'-'.$type);  | 
                                                        |
| 479 | 479 |  			$action->addAcl('admin'); | 
                                                        
| 480 | 480 | $action->setClass($fqcn);  | 
                                                        
| 481 | 481 | $action->setTitle(str_replace(  | 
                                                        
@@ -513,10 +513,10 @@ discard block  | 
                                                    ||
| 513 | 513 |  		foreach (array_keys($generators) as $type) { | 
                                                        
| 514 | 514 | // generate fqcn  | 
                                                        
| 515 | 515 |  			$className = sprintf('%s%s%sAction', $model->getPhpName(), $fkModelName, ucfirst($type)); | 
                                                        
| 516 | - $fqcn = $this->packageService->getNamespace() . '\\action\\' . $className;  | 
                                                        |
| 516 | + $fqcn = $this->packageService->getNamespace().'\\action\\'.$className;  | 
                                                        |
| 517 | 517 | |
| 518 | 518 | // generate action  | 
                                                        
| 519 | - $action = new ActionSchema($actionNamePrefix . '-' . $type);  | 
                                                        |
| 519 | + $action = new ActionSchema($actionNamePrefix.'-'.$type);  | 
                                                        |
| 520 | 520 |  			$action->addAcl('admin'); | 
                                                        
| 521 | 521 | $action->setClass($fqcn);  | 
                                                        
| 522 | 522 | $action->setTitle(str_replace(  | 
                                                        
@@ -206,20 +206,20 @@ discard block  | 
                                                    ||
| 206 | 206 | |
| 207 | 207 | // find path branch  | 
                                                        
| 208 | 208 |  		switch ($type) { | 
                                                        
| 209 | - case 'list':  | 
                                                        |
| 210 | - case 'create':  | 
                                                        |
| 211 | - $endpoint = '/' . $modelPluralName;  | 
                                                        |
| 212 | - break;  | 
                                                        |
| 209 | + case 'list':  | 
                                                        |
| 210 | + case 'create':  | 
                                                        |
| 211 | + $endpoint = '/' . $modelPluralName;  | 
                                                        |
| 212 | + break;  | 
                                                        |
| 213 | 213 | |
| 214 | - case 'read':  | 
                                                        |
| 215 | - case 'update':  | 
                                                        |
| 216 | - case 'delete':  | 
                                                        |
| 217 | -				$endpoint = '/' . $modelPluralName . '/{id}'; | 
                                                        |
| 218 | - break;  | 
                                                        |
| 214 | + case 'read':  | 
                                                        |
| 215 | + case 'update':  | 
                                                        |
| 216 | + case 'delete':  | 
                                                        |
| 217 | +			$endpoint = '/' . $modelPluralName . '/{id}'; | 
                                                        |
| 218 | + break;  | 
                                                        |
| 219 | 219 | |
| 220 | - default:  | 
                                                        |
| 221 | -				throw new \RuntimeException(sprintf('type (%s) not found, can\'t continue.', $type)); | 
                                                        |
| 222 | - break;  | 
                                                        |
| 220 | + default:  | 
                                                        |
| 221 | +			throw new \RuntimeException(sprintf('type (%s) not found, can\'t continue.', $type)); | 
                                                        |
| 222 | + break;  | 
                                                        |
| 223 | 223 | }  | 
                                                        
| 224 | 224 | |
| 225 | 225 | $path = $paths->get($endpoint);  | 
                                                        
@@ -234,45 +234,45 @@ discard block  | 
                                                    ||
| 234 | 234 | $responses = $operation->getResponses();  | 
                                                        
| 235 | 235 | |
| 236 | 236 |  		switch ($type) { | 
                                                        
| 237 | - case 'list':  | 
                                                        |
| 238 | -				$ok = $responses->get('200'); | 
                                                        |
| 239 | -				$ok->setDescription(sprintf('Array of %s', $modelPluralName)); | 
                                                        |
| 240 | -				$ok->getSchema()->setRef('#/definitions/' . 'Paged' . NameUtils::pluralize($modelObjectName)); | 
                                                        |
| 241 | - break;  | 
                                                        |
| 237 | + case 'list':  | 
                                                        |
| 238 | +			$ok = $responses->get('200'); | 
                                                        |
| 239 | +			$ok->setDescription(sprintf('Array of %s', $modelPluralName)); | 
                                                        |
| 240 | +			$ok->getSchema()->setRef('#/definitions/' . 'Paged' . NameUtils::pluralize($modelObjectName)); | 
                                                        |
| 241 | + break;  | 
                                                        |
| 242 | 242 | |
| 243 | - case 'create':  | 
                                                        |
| 244 | - // params  | 
                                                        |
| 245 | -				$body = $params->getByName('body'); | 
                                                        |
| 246 | -				$body->setName('body'); | 
                                                        |
| 247 | -				$body->setIn('body'); | 
                                                        |
| 248 | -				$body->setDescription(sprintf('The new %s', $modelName)); | 
                                                        |
| 249 | - $body->setRequired(true);  | 
                                                        |
| 250 | -				$body->getSchema()->setRef('#/definitions/Writable' . $modelObjectName); | 
                                                        |
| 243 | + case 'create':  | 
                                                        |
| 244 | + // params  | 
                                                        |
| 245 | +			$body = $params->getByName('body'); | 
                                                        |
| 246 | +			$body->setName('body'); | 
                                                        |
| 247 | +			$body->setIn('body'); | 
                                                        |
| 248 | +			$body->setDescription(sprintf('The new %s', $modelName)); | 
                                                        |
| 249 | + $body->setRequired(true);  | 
                                                        |
| 250 | +			$body->getSchema()->setRef('#/definitions/Writable' . $modelObjectName); | 
                                                        |
| 251 | 251 | |
| 252 | - // response  | 
                                                        |
| 253 | -				$ok = $responses->get('201'); | 
                                                        |
| 254 | -				$ok->setDescription(sprintf('%s created', $modelName)); | 
                                                        |
| 255 | - break;  | 
                                                        |
| 252 | + // response  | 
                                                        |
| 253 | +			$ok = $responses->get('201'); | 
                                                        |
| 254 | +			$ok->setDescription(sprintf('%s created', $modelName)); | 
                                                        |
| 255 | + break;  | 
                                                        |
| 256 | 256 | |
| 257 | - case 'read':  | 
                                                        |
| 258 | - // response  | 
                                                        |
| 259 | -				$ok = $responses->get('200'); | 
                                                        |
| 260 | -				$ok->setDescription(sprintf('gets the %s', $modelName)); | 
                                                        |
| 261 | -				$ok->getSchema()->setRef('#/definitions/' . $modelObjectName); | 
                                                        |
| 262 | - break;  | 
                                                        |
| 257 | + case 'read':  | 
                                                        |
| 258 | + // response  | 
                                                        |
| 259 | +			$ok = $responses->get('200'); | 
                                                        |
| 260 | +			$ok->setDescription(sprintf('gets the %s', $modelName)); | 
                                                        |
| 261 | +			$ok->getSchema()->setRef('#/definitions/' . $modelObjectName); | 
                                                        |
| 262 | + break;  | 
                                                        |
| 263 | 263 | |
| 264 | - case 'update':  | 
                                                        |
| 265 | - // response  | 
                                                        |
| 266 | -				$ok = $responses->get('200'); | 
                                                        |
| 267 | -				$ok->setDescription(sprintf('%s updated', $modelName)); | 
                                                        |
| 268 | -				$ok->getSchema()->setRef('#/definitions/' . $modelObjectName); | 
                                                        |
| 269 | - break;  | 
                                                        |
| 264 | + case 'update':  | 
                                                        |
| 265 | + // response  | 
                                                        |
| 266 | +			$ok = $responses->get('200'); | 
                                                        |
| 267 | +			$ok->setDescription(sprintf('%s updated', $modelName)); | 
                                                        |
| 268 | +			$ok->getSchema()->setRef('#/definitions/' . $modelObjectName); | 
                                                        |
| 269 | + break;  | 
                                                        |
| 270 | 270 | |
| 271 | - case 'delete':  | 
                                                        |
| 272 | - // response  | 
                                                        |
| 273 | -				$ok = $responses->get('204'); | 
                                                        |
| 274 | -				$ok->setDescription(sprintf('%s deleted', $modelName)); | 
                                                        |
| 275 | - break;  | 
                                                        |
| 271 | + case 'delete':  | 
                                                        |
| 272 | + // response  | 
                                                        |
| 273 | +			$ok = $responses->get('204'); | 
                                                        |
| 274 | +			$ok->setDescription(sprintf('%s deleted', $modelName)); | 
                                                        |
| 275 | + break;  | 
                                                        |
| 276 | 276 | }  | 
                                                        
| 277 | 277 | |
| 278 | 278 |  		if ($type == 'read' || $type == 'update' || $type == 'delete') { | 
                                                        
@@ -61,7 +61,7 @@ discard block  | 
                                                    ||
| 61 | 61 | |
| 62 | 62 | $module = $this->package->getKeeko()->getModule();  | 
                                                        
| 63 | 63 |  		$swagger->setVersion('2.0'); | 
                                                        
| 64 | - $swagger->getInfo()->setTitle($module->getTitle() . ' API');  | 
                                                        |
| 64 | + $swagger->getInfo()->setTitle($module->getTitle().' API');  | 
                                                        |
| 65 | 65 | $swagger->getTags()->clear();  | 
                                                        
| 66 | 66 | $swagger->getTags()->add(new Tag(['name' => $module->getSlug()]));  | 
                                                        
| 67 | 67 | |
@@ -82,7 +82,7 @@ discard block  | 
                                                    ||
| 82 | 82 |  		foreach ($models as $modelName) { | 
                                                        
| 83 | 83 | $tableName = $this->modelService->getTableName($modelName);  | 
                                                        
| 84 | 84 | $model = $this->modelService->getModel($tableName);  | 
                                                        
| 85 | -			$class = new PhpClass(str_replace('\\\\', '\\', $model->getNamespace() . '\\' . $model->getPhpName())); | 
                                                        |
| 85 | +			$class = new PhpClass(str_replace('\\\\', '\\', $model->getNamespace().'\\'.$model->getPhpName())); | 
                                                        |
| 86 | 86 | $file = new File($this->codegenService->getFilename($class));  | 
                                                        
| 87 | 87 | |
| 88 | 88 |  			if ($file->exists()) { | 
                                                        
@@ -110,7 +110,7 @@ discard block  | 
                                                    ||
| 110 | 110 | }  | 
                                                        
| 111 | 111 | |
| 112 | 112 |  	protected function generateOperation(Paths $paths, $actionName) { | 
                                                        
| 113 | -		$this->logger->notice('Generating Operation for: ' . $actionName); | 
                                                        |
| 113 | +		$this->logger->notice('Generating Operation for: '.$actionName); | 
                                                        |
| 114 | 114 | |
| 115 | 115 |  		if (Text::create($actionName)->contains('relationship')) { | 
                                                        
| 116 | 116 | $this->generateRelationshipOperation($paths, $actionName);  | 
                                                        
@@ -120,18 +120,18 @@ discard block  | 
                                                    ||
| 120 | 120 | }  | 
                                                        
| 121 | 121 | |
| 122 | 122 |  	protected function generateRelationshipOperation(Paths $paths, $actionName) { | 
                                                        
| 123 | -		$this->logger->notice('Generating Relationship Operation for: ' . $actionName); | 
                                                        |
| 123 | +		$this->logger->notice('Generating Relationship Operation for: '.$actionName); | 
                                                        |
| 124 | 124 | $prefix = substr($actionName, 0, strrpos($actionName, 'relationship') + 12);  | 
                                                        
| 125 | 125 | $module = $this->packageService->getModule();  | 
                                                        
| 126 | 126 | |
| 127 | 127 | // test for to-many relationship:  | 
                                                        
| 128 | - $many = $module->hasAction($prefix . '-read')  | 
                                                        |
| 129 | - && $module->hasAction($prefix . '-update')  | 
                                                        |
| 130 | - && $module->hasAction($prefix . '-add')  | 
                                                        |
| 131 | - && $module->hasAction($prefix . '-remove')  | 
                                                        |
| 128 | + $many = $module->hasAction($prefix.'-read')  | 
                                                        |
| 129 | + && $module->hasAction($prefix.'-update')  | 
                                                        |
| 130 | + && $module->hasAction($prefix.'-add')  | 
                                                        |
| 131 | + && $module->hasAction($prefix.'-remove')  | 
                                                        |
| 132 | 132 | ;  | 
                                                        
| 133 | - $single = $module->hasAction($prefix . '-read')  | 
                                                        |
| 134 | - && $module->hasAction($prefix . '-update')  | 
                                                        |
| 133 | + $single = $module->hasAction($prefix.'-read')  | 
                                                        |
| 134 | + && $module->hasAction($prefix.'-update')  | 
                                                        |
| 135 | 135 | && !$many  | 
                                                        
| 136 | 136 | ;  | 
                                                        
| 137 | 137 | |
@@ -159,7 +159,7 @@ discard block  | 
                                                    ||
| 159 | 159 | $action = $this->packageService->getAction($actionName);  | 
                                                        
| 160 | 160 | $type = substr($actionName, strrpos($actionName, '-') + 1);  | 
                                                        
| 161 | 161 | $method = $this->getMethod($type);  | 
                                                        
| 162 | -		$endpoint = '/' . NameUtils::pluralize($modelName) . '/{id}/relationship/' . ($single ? | 
                                                        |
| 162 | +		$endpoint = '/'.NameUtils::pluralize($modelName).'/{id}/relationship/'.($single ? | 
                                                        |
| 163 | 163 | $foreignModelName : NameUtils::pluralize($foreignModelName));  | 
                                                        
| 164 | 164 | |
| 165 | 165 | $path = $paths->get($endpoint);  | 
                                                        
@@ -190,7 +190,7 @@ discard block  | 
                                                    ||
| 190 | 190 | }  | 
                                                        
| 191 | 191 | |
| 192 | 192 |  	protected function generateCRUDOperation(Paths $paths, $actionName) { | 
                                                        
| 193 | -		$this->logger->notice('Generating CRUD Operation for: ' . $actionName); | 
                                                        |
| 193 | +		$this->logger->notice('Generating CRUD Operation for: '.$actionName); | 
                                                        |
| 194 | 194 | $database = $this->modelService->getDatabase();  | 
                                                        
| 195 | 195 | $action = $this->packageService->getAction($actionName);  | 
                                                        
| 196 | 196 | $modelName = $this->modelService->getModelNameByAction($action);  | 
                                                        
@@ -208,13 +208,13 @@ discard block  | 
                                                    ||
| 208 | 208 |  		switch ($type) { | 
                                                        
| 209 | 209 | case 'list':  | 
                                                        
| 210 | 210 | case 'create':  | 
                                                        
| 211 | - $endpoint = '/' . $modelPluralName;  | 
                                                        |
| 211 | + $endpoint = '/'.$modelPluralName;  | 
                                                        |
| 212 | 212 | break;  | 
                                                        
| 213 | 213 | |
| 214 | 214 | case 'read':  | 
                                                        
| 215 | 215 | case 'update':  | 
                                                        
| 216 | 216 | case 'delete':  | 
                                                        
| 217 | -				$endpoint = '/' . $modelPluralName . '/{id}'; | 
                                                        |
| 217 | +				$endpoint = '/'.$modelPluralName.'/{id}'; | 
                                                        |
| 218 | 218 | break;  | 
                                                        
| 219 | 219 | |
| 220 | 220 | default:  | 
                                                        
@@ -237,7 +237,7 @@ discard block  | 
                                                    ||
| 237 | 237 | case 'list':  | 
                                                        
| 238 | 238 |  				$ok = $responses->get('200'); | 
                                                        
| 239 | 239 |  				$ok->setDescription(sprintf('Array of %s', $modelPluralName)); | 
                                                        
| 240 | -				$ok->getSchema()->setRef('#/definitions/' . 'Paged' . NameUtils::pluralize($modelObjectName)); | 
                                                        |
| 240 | +				$ok->getSchema()->setRef('#/definitions/'.'Paged'.NameUtils::pluralize($modelObjectName)); | 
                                                        |
| 241 | 241 | break;  | 
                                                        
| 242 | 242 | |
| 243 | 243 | case 'create':  | 
                                                        
@@ -247,7 +247,7 @@ discard block  | 
                                                    ||
| 247 | 247 |  				$body->setIn('body'); | 
                                                        
| 248 | 248 |  				$body->setDescription(sprintf('The new %s', $modelName)); | 
                                                        
| 249 | 249 | $body->setRequired(true);  | 
                                                        
| 250 | -				$body->getSchema()->setRef('#/definitions/Writable' . $modelObjectName); | 
                                                        |
| 250 | +				$body->getSchema()->setRef('#/definitions/Writable'.$modelObjectName); | 
                                                        |
| 251 | 251 | |
| 252 | 252 | // response  | 
                                                        
| 253 | 253 |  				$ok = $responses->get('201'); | 
                                                        
@@ -258,14 +258,14 @@ discard block  | 
                                                    ||
| 258 | 258 | // response  | 
                                                        
| 259 | 259 |  				$ok = $responses->get('200'); | 
                                                        
| 260 | 260 |  				$ok->setDescription(sprintf('gets the %s', $modelName)); | 
                                                        
| 261 | -				$ok->getSchema()->setRef('#/definitions/' . $modelObjectName); | 
                                                        |
| 261 | +				$ok->getSchema()->setRef('#/definitions/'.$modelObjectName); | 
                                                        |
| 262 | 262 | break;  | 
                                                        
| 263 | 263 | |
| 264 | 264 | case 'update':  | 
                                                        
| 265 | 265 | // response  | 
                                                        
| 266 | 266 |  				$ok = $responses->get('200'); | 
                                                        
| 267 | 267 |  				$ok->setDescription(sprintf('%s updated', $modelName)); | 
                                                        
| 268 | -				$ok->getSchema()->setRef('#/definitions/' . $modelObjectName); | 
                                                        |
| 268 | +				$ok->getSchema()->setRef('#/definitions/'.$modelObjectName); | 
                                                        |
| 269 | 269 | break;  | 
                                                        
| 270 | 270 | |
| 271 | 271 | case 'delete':  | 
                                                        
@@ -352,19 +352,19 @@ discard block  | 
                                                    ||
| 352 | 352 | }  | 
                                                        
| 353 | 353 | |
| 354 | 354 |  	protected function generateDefinition(Definitions $definitions, Table $model) { | 
                                                        
| 355 | -		$this->logger->notice('Generating Definition for: ' . $model->getOriginCommonName()); | 
                                                        |
| 355 | +		$this->logger->notice('Generating Definition for: '.$model->getOriginCommonName()); | 
                                                        |
| 356 | 356 | $modelObjectName = $model->getPhpName();  | 
                                                        
| 357 | 357 | |
| 358 | 358 | // paged model  | 
                                                        
| 359 | - $pagedModel = 'Paged' . NameUtils::pluralize($modelObjectName);  | 
                                                        |
| 359 | + $pagedModel = 'Paged'.NameUtils::pluralize($modelObjectName);  | 
                                                        |
| 360 | 360 |  		$paged = $definitions->get($pagedModel)->setType('object')->getProperties(); | 
                                                        
| 361 | 361 |  		$paged->get('data') | 
                                                        
| 362 | 362 |  			->setType('array') | 
                                                        
| 363 | -			->getItems()->setRef('#/definitions/' . $modelObjectName); | 
                                                        |
| 363 | +			->getItems()->setRef('#/definitions/'.$modelObjectName); | 
                                                        |
| 364 | 364 |  		$paged->get('meta')->setRef('#/definitions/PagedMeta'); | 
                                                        
| 365 | 365 | |
| 366 | 366 | // writable model  | 
                                                        
| 367 | -		$writable = $definitions->get('Writable' . $modelObjectName)->setType('object')->getProperties(); | 
                                                        |
| 367 | +		$writable = $definitions->get('Writable'.$modelObjectName)->setType('object')->getProperties(); | 
                                                        |
| 368 | 368 | $this->generateModelProperties($writable, $model, true);  | 
                                                        
| 369 | 369 | |
| 370 | 370 | // readable model  | 
                                                        
@@ -1,14 +1,10 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | namespace keeko\tools\command;  | 
                                                        
| 3 | 3 | |
| 4 | -use keeko\framework\schema\ActionSchema;  | 
                                                        |
| 5 | -use keeko\framework\utils\NameUtils;  | 
                                                        |
| 6 | 4 | use keeko\tools\generator\domain\DomainGenerator;  | 
                                                        
| 7 | 5 | use keeko\tools\generator\domain\DomainTraitGenerator;  | 
                                                        
| 8 | 6 | use keeko\tools\generator\domain\ReadOnlyDomainTraitGenerator;  | 
                                                        
| 9 | 7 | use keeko\tools\helpers\QuestionHelperTrait;  | 
                                                        
| 10 | -use keeko\tools\utils\NamespaceResolver;  | 
                                                        |
| 11 | -use phootwork\lang\Text;  | 
                                                        |
| 12 | 8 | use Propel\Generator\Model\Table;  | 
                                                        
| 13 | 9 | use Symfony\Component\Console\Input\InputArgument;  | 
                                                        
| 14 | 10 | use Symfony\Component\Console\Input\InputInterface;  | 
                                                        
@@ -54,7 +54,7 @@ discard block  | 
                                                    ||
| 54 | 54 |  	protected function initialize(InputInterface $input, OutputInterface $output) { | 
                                                        
| 55 | 55 | parent::initialize($input, $output);  | 
                                                        
| 56 | 56 | |
| 57 | - $loader = new \Twig_Loader_Filesystem($this->service->getConfig()->getTemplateRoot() . '/domain');  | 
                                                        |
| 57 | + $loader = new \Twig_Loader_Filesystem($this->service->getConfig()->getTemplateRoot().'/domain');  | 
                                                        |
| 58 | 58 | $this->twig = new \Twig_Environment($loader);  | 
                                                        
| 59 | 59 | }  | 
                                                        
| 60 | 60 | |
@@ -150,7 +150,7 @@ discard block  | 
                                                    ||
| 150 | 150 | }  | 
                                                        
| 151 | 151 | |
| 152 | 152 |  	private function generateModel($modelName) { | 
                                                        
| 153 | -		$this->logger->info('Generate Domain from Model: ' . $modelName); | 
                                                        |
| 153 | +		$this->logger->info('Generate Domain from Model: '.$modelName); | 
                                                        |
| 154 | 154 | $model = $this->modelService->getModel($modelName);  | 
                                                        
| 155 | 155 | |
| 156 | 156 | // generate class  | 
                                                        
@@ -11,9 +11,8 @@  | 
                                                    ||
| 11 | 11 | /**  | 
                                                        
| 12 | 12 | * Generates an action trait with the given name as classname  | 
                                                        
| 13 | 13 | *  | 
                                                        
| 14 | - * @param string $name  | 
                                                        |
| 15 | 14 | * @param ActionSchema $action  | 
                                                        
| 16 | - * @return PhpTrait  | 
                                                        |
| 15 | + * @return PhpClass  | 
                                                        |
| 17 | 16 | */  | 
                                                        
| 18 | 17 |  	public function generate(ActionSchema $action) { | 
                                                        
| 19 | 18 | $class = PhpClass::create($action->getClass())  | 
                                                        
@@ -17,7 +17,7 @@  | 
                                                    ||
| 17 | 17 | */  | 
                                                        
| 18 | 18 |  	public function generate(ActionSchema $action) { | 
                                                        
| 19 | 19 | $class = PhpClass::create($action->getClass())  | 
                                                        
| 20 | -			->setDescription('Action Class for ' . $action->getName()) | 
                                                        |
| 20 | +			->setDescription('Action Class for '.$action->getName()) | 
                                                        |
| 21 | 21 |  			->setLongDescription('This code is automatically created. Modifications will probably be overwritten.'); | 
                                                        
| 22 | 22 | |
| 23 | 23 | $this->ensureBasicSetup($class);  |