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

generate()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
rs 8.8571
cc 1
eloc 17
nc 1
nop 4
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
}