Completed
Push — master ( 94e820...3f0fe0 )
by Thomas
10:39
created

ModuleActionUpdateAction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 7
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureParams() 0 3 1
A run() 0 11 2
1
<?php
2
namespace keeko\core\action;
3
4
use keeko\framework\foundation\AbstractAction;
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\HttpFoundation\Response;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
use phootwork\json\Json;
9
use Tobscure\JsonApi\Exception\InvalidParameterException;
10
use keeko\core\domain\ModuleDomain;
11
12
/**
13
 * Updates the relationship of module to action
14
 * 
15
 * This code is automatically created. Modifications will probably be overwritten.
16
 * 
17
 * @author gossi
18
 */
19
class ModuleActionUpdateAction extends AbstractAction {
20
21
	/**
22
	 * @param OptionsResolver $resolver
23
	 */
24
	public function configureParams(OptionsResolver $resolver) {
25
		$resolver->setRequired(['id']);
26
	}
27
28
	/**
29
	 * Automatically generated run method
30
	 * 
31
	 * @param Request $request
32
	 * @return Response
33
	 */
34
	public function run(Request $request) {
35
		$body = Json::decode($request->getContent());
36
		if (!isset($body['data'])) {
37
			throw new InvalidParameterException();
38
		}
39
		$data = $body['data'];
40
		$id = $this->getParam('id');
41
		$domain = new ModuleDomain($this->getServiceContainer());
42
		$payload = $domain->updateAction($id, $data);
0 ignored issues
show
Bug introduced by
The method updateAction() does not exist on keeko\core\domain\ModuleDomain. Did you maybe mean update()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
43
		return $this->responder->run($request, $payload);
44
	}
45
}
46