|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ClientBundle\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class Contact |
|
9
|
|
|
* @ORM\Entity(repositoryClass="ClientBundle\Repository\ContactRepository") |
|
10
|
|
|
* @ORM\Table(name="contact") |
|
11
|
|
|
*/ |
|
12
|
|
|
class Contact |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @ORM\Column(type="integer") |
|
16
|
|
|
* @ORM\Id |
|
17
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
|
18
|
|
|
*/ |
|
19
|
|
|
private $id; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @ORM\ManyToOne(targetEntity="ContactType") |
|
23
|
|
|
*/ |
|
24
|
|
|
private $type; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @ORM\Column(type="string", length=100, nullable=true) |
|
28
|
|
|
*/ |
|
29
|
|
|
private $mean; |
|
30
|
|
|
/** |
|
31
|
|
|
* @ORM\ManyToOne(targetEntity="Client", inversedBy="contacts") |
|
32
|
|
|
* @ORM\JoinColumn(name="client_id", referencedColumnName="id") |
|
33
|
|
|
*/ |
|
34
|
|
|
private $client; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Get id |
|
38
|
|
|
* |
|
39
|
|
|
* @return integer |
|
40
|
|
|
*/ |
|
41
|
|
|
public function getId() |
|
42
|
|
|
{ |
|
43
|
|
|
return $this->id; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Set mean |
|
48
|
|
|
* |
|
49
|
|
|
* @param string $mean |
|
50
|
|
|
* |
|
51
|
|
|
* @return Contact |
|
52
|
|
|
*/ |
|
53
|
|
|
public function setMean($mean) |
|
54
|
|
|
{ |
|
55
|
|
|
$this->mean = $mean; |
|
56
|
|
|
|
|
57
|
|
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Get mean |
|
62
|
|
|
* |
|
63
|
|
|
* @return string |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getMean() |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->mean; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Get displaName |
|
72
|
|
|
* |
|
73
|
|
|
* @return string |
|
74
|
|
|
*/ |
|
75
|
|
|
public function getDisplayName() |
|
76
|
|
|
{ |
|
77
|
|
|
$displayName = ''; |
|
78
|
|
|
if (!empty($this->getType()) && !empty($this->getType()->getName())) { |
|
79
|
|
|
$displayName = $this->getType()->getName(); |
|
80
|
|
|
} |
|
81
|
|
|
if (!empty($this->getMean())) { |
|
82
|
|
|
if (!empty($displayName)) { |
|
83
|
|
|
$displayName .= ': '; |
|
84
|
|
|
} |
|
85
|
|
|
$displayName .= $this->getMean(); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
return $displayName; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Set client |
|
93
|
|
|
* |
|
94
|
|
|
* @param \ClientBundle\Entity\Client $client |
|
95
|
|
|
* |
|
96
|
|
|
* @return Contact |
|
97
|
|
|
*/ |
|
98
|
|
|
public function setClient(\ClientBundle\Entity\Client $client = null) |
|
99
|
|
|
{ |
|
100
|
|
|
$this->client = $client; |
|
101
|
|
|
|
|
102
|
|
|
return $this; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* Get client |
|
107
|
|
|
* |
|
108
|
|
|
* @return \ClientBundle\Entity\Client |
|
109
|
|
|
*/ |
|
110
|
|
|
public function getClient() |
|
111
|
|
|
{ |
|
112
|
|
|
return $this->client; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Set type |
|
117
|
|
|
* |
|
118
|
|
|
* @param \ClientBundle\Entity\ContactType $type |
|
119
|
|
|
* |
|
120
|
|
|
* @return Contact |
|
121
|
|
|
*/ |
|
122
|
|
|
public function setType(\ClientBundle\Entity\ContactType $type = null) |
|
123
|
|
|
{ |
|
124
|
|
|
$this->type = $type; |
|
125
|
|
|
|
|
126
|
|
|
return $this; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Get type |
|
131
|
|
|
* |
|
132
|
|
|
* @return \ClientBundle\Entity\ContactType |
|
133
|
|
|
*/ |
|
134
|
|
|
public function getType() |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->type; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @return string |
|
141
|
|
|
*/ |
|
142
|
|
|
public function __toString() |
|
143
|
|
|
{ |
|
144
|
|
|
return (string) $this->getDisplayName(); |
|
145
|
|
|
} |
|
146
|
|
|
} |
|
147
|
|
|
|