Completed
Push — SF4 ( cbb2b6...71859c )
by Laurent
02:09
created

Unit::setAbbr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/**
4
 * Entity Unit.
5
 *
6
 * PHP Version 7
7
 *
8
 * @author    Quétier Laurent <[email protected]>
9
 * @copyright 2018 Dev-Int GLSR
10
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
11
 *
12
 * @version GIT: $Id$
13
 *
14
 * @link https://github.com/Dev-Int/glsr
15
 */
16
namespace App\Entity\Settings\Diverse;
17
18
use Doctrine\ORM\Mapping as ORM;
19
use Gedmo\Mapping\Annotation as Gedmo;
20
21
/**
22
 * Unit Entité.
23
 *
24
 * @category Entity
25
 *
26
 * @ORM\Table(name="app_unit")
27
 * @ORM\Entity(repositoryClass="App\Repository\Settings\Diverse\UnitRepository")
28
 */
29
class Unit
30
{
31
    /**
32
     * @var int Id of unit
33
     *
34
     * @ORM\Column(name="id", type="integer")
35
     * @ORM\Id
36
     * @ORM\GeneratedValue(strategy="AUTO")
37
     */
38
    private $id;
39
40
    /**
41
     * @var string Name of unit
42
     *
43
     * @ORM\Column(name="name", type="string", length=255)
44
     */
45
    private $name;
46
47
    /**
48
     * @var string Abbreviation of the unit
49
     *
50
     * @ORM\Column(name="abbr", type="string", length=50)
51
     */
52
    private $abbr;
53
    
54
    /**
55
     * @var string Slug name
56
     * @Gedmo\Slug(fields={"name"})
57
     * @ORM\Column(length=128, unique=true)
58
     */
59
    private $slug;
60
61
    /**
62
     * Get id
63
     *
64
     * @return integer
65
     */
66
    public function getId()
67
    {
68
        return $this->id;
69
    }
70
71
    /**
72
     * Set name
73
     *
74
     * @param string $name
75
     * @return Unit
76
     */
77
    public function setName($name)
78
    {
79
        $this->name = $name;
80
81
        return $this;
82
    }
83
84
    /**
85
     * Get name
86
     *
87
     * @return string
88
     */
89
    public function getName()
90
    {
91
        return $this->name;
92
    }
93
94
    /**
95
     * Set abbr
96
     *
97
     * @param string $abbr
98
     * @return Unit
99
     */
100
    public function setAbbr($abbr)
101
    {
102
        $this->abbr = $abbr;
103
104
        return $this;
105
    }
106
107
    /**
108
     * Get abbr
109
     *
110
     * @return string
111
     */
112
    public function getAbbr()
113
    {
114
        return $this->abbr;
115
    }
116
117
    /**
118
     * Get slug
119
     *
120
     * @return string
121
     */
122
    public function getSlug()
123
    {
124
        return $this->slug;
125
    }
126
127
    /**
128
     * This method lets you do "echo $unit".
129
     * <p>So, to "show" $unit,
130
     * PHP will actually show the return of this method. <br />
131
     * Here, the name, so "echo $unit"
132
     * is equivalent to "echo $unit->getName ()"</p>.
133
     *
134
     * @return string name
135
     */
136
    public function __toString()
137
    {
138
        return $this->abbr;
139
    }
140
}
141