Completed
Push — master ( aed9ca...2c3b30 )
by Andrew
07:52
created

Contact::setMean()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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