-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathTour.php
76 lines (66 loc) · 1.43 KB
/
Tour.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace AppBundle\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use AppBundle\Api\Dto\TourInput;
use AppBundle\Entity\Sylius\Order;
use AppBundle\Entity\Task\CollectionInterface as TaskCollectionInterface;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ApiResource(
* collectionOperations={
* "post"={
* "method"="POST",
* "input"=TourInput::class
* }
* },
* itemOperations={
* "get"={
* "method"="GET"
* }
* },
* attributes={
* "denormalization_context"={"groups"={"tour"}},
* "normalization_context"={"groups"={"task_collection", "task", "tour"}}
* }
* )
*/
class Tour extends TaskCollection implements TaskCollectionInterface
{
protected $id;
/**
* @var string
* @Groups({"tour", "task"})
*/
protected $name;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
public function addTask(Task $task, $position = null)
{
$task->setTour($this);
return parent::addTask($task, $position);
}
}