Completed
Push — master ( d6c5c0...118f52 )
by Thomas
04:57
created

ModelPaginateActionGenerator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
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 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A addMethods() 0 15 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 ModelPaginateActionGenerator 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('paginate-configureParams.twig'));
18
19
		// method: run(Request $request)
20
		$class->addUseStatement('keeko\\framework\\utils\\Parameters');
21
		$class->addUseStatement(str_replace('model', 'domain', $model->getNamespace()) . '\\' . $model->getPhpName() . 'Domain');
22
		$class->setMethod($this->generateRunMethod($this->twig->render('paginate-run.twig', [
23
			'domain' => $model->getPhpName() . 'Domain'
24
		])));
25
			
26
	}
27
28
}
29