Completed
Push — master ( 2fb143...d99a08 )
by Thomas
09:36
created

ModelReadActionGenerator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A addMethods() 0 13 1
1
<?php
2
namespace keeko\tools\generator\action;
3
4
use gossi\codegen\model\PhpClass;
5
use keeko\framework\schema\ActionSchema;
6
7
class ModelReadActionGenerator extends AbstractModelActionGenerator {
8
	
9
	/* (non-PHPdoc)
10
	 * @see \keeko\tools\generator\AbstractTraitGenerator::addMethods()
11
	 */
12
	protected function addMethods(PhpClass $class, ActionSchema $action) {
13
		$modelName = $this->modelService->getModelNameByAction($action);
14
		$model = $this->modelService->getModel($modelName);
15
	
16
		// method: configureParams(OptionsResolver $resolver)
17
		$this->addConfigureParamsMethod($class, $this->twig->render('read-configureParams.twig'));
18
	
19
		// method: run(Request $request)
20
		$class->addUseStatement(str_replace('model', 'domain', $model->getNamespace()) . '\\' . $model->getPhpName() . 'Domain');
21
		$class->setMethod($this->generateRunMethod($this->twig->render('read-run.twig', [
22
			'domain' => $model->getPhpName() . 'Domain'
23
		])));
24
	}
25
	
26
}