1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AppBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Knp\DoctrineBehaviors\Model as ORMBehaviors; |
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Event. |
12
|
|
|
* |
13
|
|
|
* @ORM\Table(name="event") |
14
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\EventRepository") |
15
|
|
|
*/ |
16
|
|
|
class Event implements \JsonSerializable |
17
|
|
|
{ |
18
|
|
|
use ORMBehaviors\Timestampable\Timestampable; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var int |
22
|
|
|
* |
23
|
|
|
* @ORM\Column(name="id", type="integer") |
24
|
|
|
* @ORM\Id |
25
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
26
|
|
|
*/ |
27
|
|
|
private $id; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
* |
32
|
|
|
* @ORM\Column(type="string", length=255) |
33
|
|
|
* @Groups({"Short"}) |
34
|
|
|
*/ |
35
|
|
|
private $googleId; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var ArrayCollection|$users[] |
39
|
|
|
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", mappedBy="events", cascade={"persist"}) |
40
|
|
|
*/ |
41
|
|
|
private $users = []; |
42
|
|
|
|
43
|
|
|
public function __construct() |
44
|
|
|
{ |
45
|
|
|
$this->users = new ArrayCollection(); |
|
|
|
|
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function jsonSerialize() |
49
|
|
|
{ |
50
|
|
|
return [ |
51
|
|
|
'event' => $this->getGoogleId(), |
52
|
|
|
]; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Get id. |
57
|
|
|
* |
58
|
|
|
* @return int |
59
|
|
|
*/ |
60
|
|
|
public function getId() |
61
|
|
|
{ |
62
|
|
|
return $this->id; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Set googleId. |
67
|
|
|
* |
68
|
|
|
* @param string $googleId |
69
|
|
|
* |
70
|
|
|
* @return Event |
71
|
|
|
*/ |
72
|
|
|
public function setGoogleId($googleId) |
73
|
|
|
{ |
74
|
|
|
$this->googleId = $googleId; |
75
|
|
|
|
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Get googleId. |
81
|
|
|
* |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
public function getGoogleId() |
85
|
|
|
{ |
86
|
|
|
return $this->googleId; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Add user. |
91
|
|
|
* |
92
|
|
|
* @param User $user |
93
|
|
|
* |
94
|
|
|
* @return Event |
95
|
|
|
*/ |
96
|
|
|
public function addUser(User $user) |
97
|
|
|
{ |
98
|
|
|
$this->users[] = $user; |
99
|
|
|
|
100
|
|
|
return $this; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Remove user. |
105
|
|
|
* |
106
|
|
|
* @param User $user |
107
|
|
|
*/ |
108
|
|
|
public function removeUser(User $user) |
109
|
|
|
{ |
110
|
|
|
$this->users->removeElement($user); |
|
|
|
|
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Get users. |
115
|
|
|
* |
116
|
|
|
* @return ArrayCollection |
117
|
|
|
*/ |
118
|
|
|
public function getUsers() |
119
|
|
|
{ |
120
|
|
|
return $this->users; |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..