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

ModelReadActionGenerator::addMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
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
}