Completed
Pull Request — master (#30)
by
unknown
03:43
created

Event::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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
9
/**
10
 * Event.
11
 *
12
 * @ORM\Table(name="event")
13
 * @ORM\Entity(repositoryClass="AppBundle\Repository\EventRepository")
14
 */
15
class Event
16
{
17
    use ORMBehaviors\Timestampable\Timestampable;
18
19
    /**
20
     * @var int
21
     *
22
     * @ORM\Column(name="id", type="integer")
23
     * @ORM\Id
24
     * @ORM\GeneratedValue(strategy="AUTO")
25
     */
26
    private $id;
27
28
    /**
29
     * @var string
30
     *
31
     * @ORM\Column(name="name", type="string", length=255)
32
     */
33
    private $googleId;
34
35
    /**
36
     * @var ArrayCollection|$users[]
37
     * @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", mappedBy="events", cascade={"persist"})
38
     */
39
    private $users = [];
40
41
    public function __construct()
42
    {
43
        $this->users = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array of property $users.

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..

Loading history...
44
    }
45
46
    /**
47
     * Get id
48
     *
49
     * @return integer
50
     */
51
    public function getId()
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * Set googleId
58
     *
59
     * @param string $googleId
60
     *
61
     * @return Event
62
     */
63
    public function setGoogleId($googleId)
64
    {
65
        $this->googleId = $googleId;
66
67
        return $this;
68
    }
69
70
    /**
71
     * Get googleId
72
     *
73
     * @return string
74
     */
75
    public function getGoogleId()
76
    {
77
        return $this->googleId;
78
    }
79
80
    /**
81
     * Add user
82
     *
83
     * @param User $user
84
     *
85
     * @return Event
86
     */
87
    public function addUser(User $user)
88
    {
89
        $this->users[] = $user;
90
91
        return $this;
92
    }
93
94
    /**
95
     * Remove user
96
     *
97
     * @param User $user
98
     */
99
    public function removeUser(User $user)
100
    {
101
        $this->users->removeElement($user);
0 ignored issues
show
Bug introduced by
The method removeElement cannot be called on $this->users (of type array).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
102
    }
103
104
    /**
105
     * Get users
106
     *
107
     * @return ArrayCollection
108
     */
109
    public function getUsers()
110
    {
111
        return $this->users;
112
    }
113
}
114