Device::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace KI\UserBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use JMS\Serializer\Annotation as JMS;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
/**
10
 * Définit un appareil (téléphone, tablette) enregistré pour recevoir des notifications push
11
 * @ORM\Entity
12
 * @JMS\ExclusionPolicy("all")
13
 */
14
class Device
15
{
16
    /**
17
     * @ORM\Id
18
     * @ORM\Column(type="integer")
19
     * @ORM\GeneratedValue(strategy="AUTO")
20
     */
21
    protected $id;
22
23
    /**
24
     * Identifiant du téléphone
25
     * @ORM\Column(name="device", type="string", unique=true)
26
     * @JMS\Expose
27
     * @Assert\Type("string")
28
     */
29
    protected $device;
30
31
    /**
32
     * Type (iOS|Android|WP)
33
     * @ORM\Column(name="type", type="string")
34
     * @JMS\Expose
35
     * @Assert\Type("string")
36
     */
37
    protected $type;
38
39
    /**
40
     * @ORM\ManyToOne(targetEntity="KI\UserBundle\Entity\User", inversedBy="devices")
41
     * @ORM\JoinColumn(nullable=false)
42
     */
43
    protected $owner;
44
45
46
47
48
49
50
51
    //===== GENERATED AUTOMATICALLY =====//
52
53
    /**
54
     * Get id
55
     *
56
     * @return integer
57
     */
58
    public function getId()
59
    {
60
        return $this->id;
61
    }
62
63
    /**
64
     * Set device
65
     *
66
     * @param string $device
67
     * @return Device
68
     */
69
    public function setDevice($device)
70
    {
71
        $this->device = $device;
72
73
        return $this;
74
    }
75
76
    /**
77
     * Get device
78
     *
79
     * @return string
80
     */
81
    public function getDevice()
82
    {
83
        return $this->device;
84
    }
85
86
    /**
87
     * Set type
88
     *
89
     * @param string $type
90
     * @return Device
91
     */
92
    public function setType($type)
93
    {
94
        if ($type == 'iOS' || $type == 'WP' || $type == 'Android')
95
            $this->type = $type;
96
        return $this;
97
    }
98
99
    /**
100
     * Get type
101
     *
102
     * @return string
103
     */
104
    public function getType()
105
    {
106
        return $this->type;
107
    }
108
109
    /**
110
     * Set owner
111
     *
112
     * @param \KI\UserBundle\Entity\User $owner
113
     * @return Device
114
     */
115
    public function setOwner(\KI\UserBundle\Entity\User $owner)
116
    {
117
        $this->owner = $owner;
118
119
        return $this;
120
    }
121
122
    /**
123
     * Get owner
124
     *
125
     * @return \KI\UserBundle\Entity\User
126
     */
127
    public function getOwner()
128
    {
129
        return $this->owner;
130
    }
131
}
132