-
Notifications
You must be signed in to change notification settings - Fork 692
Expand file tree
/
Copy pathRequestBodyParamConverterController.php
More file actions
53 lines (44 loc) · 1.16 KB
/
RequestBodyParamConverterController.php
File metadata and controls
53 lines (44 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/*
* This file is part of the FOSRestBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
class RequestBodyParamConverterController extends AbstractController
{
/**
* @ParamConverter("post", converter="fos_rest.request_body")
*/
public function putPostAction(Post $post, \Datetime $date): \Symfony\Component\HttpFoundation\Response
{
return new Response($post->getName());
}
}
class Post
{
private $name;
private $body;
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
public function getBody()
{
return $this->body;
}
public function setBody($body)
{
$this->body = $body;
}
}