Completed
Push — master ( da62ab...2e0a22 )
by Thomas
09:51
created

ToManyRelationshipUpdateActionGenerator   A

Complexity

Total Complexity 1

Size/Duplication

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B generate() 0 25 1
1
<?php
2
namespace keeko\tools\generator\action;
3
4
use gossi\codegen\model\PhpClass;
5
use keeko\tools\generator\AbstractActionGenerator;
6
use Propel\Generator\Model\Table;
7
8
class ToManyRelationshipUpdateActionGenerator extends AbstractActionGenerator {
9
10
	/**
11
	 * Add default blank methods
12
	 * 
13
	 * @param PhpClass $class
14
	 */
15
	public function generate(PhpClass $class, Table $model, Table $foreignModel, Table $middle) {
16
		// add use statements
17
		$this->ensureBasicSetup($class);
18
		
19
		// method: configureParams(OptionsResolver $resolver)
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
20
		$this->addConfigureParamsMethod($class, $this->twig->render('relationship-configureParams.twig'));
21
22
		// method: run(Request $request) : Response
0 ignored issues
show
Unused Code Comprehensibility introduced by
39% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
23
		$class->addUseStatement('Symfony\\Component\\HttpFoundation\\Request');
24
		$class->addUseStatement('Symfony\\Component\\HttpFoundation\\Response');
25
		$class->addUseStatement('Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException');
26
		$class->addUseStatement('Tobscure\\JsonApi\\Exception\\InvalidParameterException');
27
		$class->addUseStatement($middle->getNamespace() . '\\' . $middle->getPhpName() . 'Query');
28
		$class->addUseStatement($model->getNamespace() . '\\' . $model->getPhpName() . 'Query');
29
		$class->addUseStatement($model->getNamespace() . '\\' . $foreignModel->getPhpName() . 'Query');
30
		$class->setMethod($this->generateRunMethod($this->twig->render('to-many-update-run.twig', [
31
			'model' => $model->getCamelCaseName(),
32
			'class' => $model->getPhpName(),
33
			'foreign_model' => $foreignModel->getCamelCaseName(),
34
			'foreign_class' => $foreignModel->getPhpName(),
35
			'fk_class' => $middle->getPhpName()
36
		])));
37
38
		return $class;
39
	}
40
}