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

ModuleActionUpdateAction::configureParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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