Completed
Push — Recipes ( c99128 )
by Laurent
13:15
created

Unit   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 112
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 112
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A setAbbr() 0 6 1
A getAbbr() 0 4 1
A getSlug() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
/**
4
 * Entité Unit.
5
 *
6
 * PHP Version 5
7
 *
8
 * @author    Quétier Laurent <[email protected]>
9
 * @copyright 2014 Dev-Int GLSR
10
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
11
 *
12
 * @version GIT: <git_id>
13
 *
14
 * @link https://github.com/Dev-Int/glsr
15
 */
16
namespace AppBundle\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="gs_unit")
27
 * @ORM\Entity(repositoryClass="AppBundle\Repository\Settings\Diverse\UnitRepository")
28
 */
29
class Unit
30
{
31
    /**
32
     * @var int Id de l'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 Nom de l'unité
42
     *
43
     * @ORM\Column(name="name", type="string", length=255)
44
     */
45
    private $name;
46
47
    /**
48
     * @var string Abbréviation de l'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
     * Cette méthode permet de faire "echo $unit".
129
     * <p>Ainsi, pour "afficher" $unit,
130
     * PHP affichera en réalité le retour de cette méthode.<br />
131
     * Ici, le nom, donc "echo $unit"
132
     * est équivalent à "echo $unit->getName()"</p>.
133
     *
134
     * @return string name
135
     */
136
    public function __toString()
137
    {
138
        return $this->abbr;
139
    }
140
}
141