Completed
Push — sf2.7 ( 713b85...c5eeb4 )
by Laurent
03:31
created

FamilyLog::setPath()   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
 * Entité FamilyLog.
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    since 1.0.0
13
 *
14
 * @link       https://github.com/Dev-Int/glsr
15
 */
16
namespace AppBundle\Entity;
17
18
use Doctrine\ORM\Mapping as ORM;
19
use Gedmo\Mapping\Annotation as Gedmo;
20
21
/**
22
 * FamilyLog Entité FamilyLog.
23
 *
24
 * @category   Entity
25
 *
26
 * @Gedmo\Tree(type="materializedPath")
27
 * @ORM\Table(name="gs_familylog")
28
 * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\MaterializedPathRepository")
29
 */
30
class FamilyLog
31
{
32
    /**
33
     * @var int Id de la famille logistique
34
     *
35
     * @ORM\Column(name="id", type="integer")
36
     * @ORM\Id
37
     * @ORM\GeneratedValue(strategy="AUTO")
38
     */
39
    private $id;
40
41
    /**
42
     * @Gedmo\TreePath
43
     * @ORM\Column(length=3000, nullable=true)
44
     */
45
    private $path;
46
47
    /**
48
     * @Gedmo\TreePathSource
49
     * @var string Nom de la famille logistique
50
     *
51
     * @ORM\Column(name="name", type="string", length=255)
52
     */
53
    private $name;
54
    
55
    /**
56
     * @var string Slug name
57
     * @Gedmo\Slug(fields={"name"})
58
     * @ORM\Column(length=128, unique=true)
59
     */
60
    private $slug;
61
62
    /**
63
     * @Gedmo\TreeParent
64
     * @ORM\ManyToOne(targetEntity="FamilyLog", inversedBy="children")
65
     * @ORM\JoinColumn(referencedColumnName="id", onDelete="CASCADE")
66
     */
67
    private $parent;
68
69
    /**
70
     * @Gedmo\TreeLevel
71
     * @ORM\Column(type="integer", nullable=true)
72
     */
73
    private $level;
74
75
    /**
76
     * @ORM\OneToMany(targetEntity="FamilyLog", mappedBy="parent")
77
     */
78
    private $children;
79
 
80
    /**
81
     * Get id.
82
     *
83
     * @return int
84
     */
85
    public function getId()
86
    {
87
        return $this->id;
88
    }
89
90
    /**
91
     * Set name.
92
     *
93
     * @param string $name Désignation
94
     *
95
     * @return FamilyLog
96
     */
97
    public function setName($name)
98
    {
99
        $this->name = $name;
100
101
        return $this;
102
    }
103
104
    /**
105
     * Get name.
106
     *
107
     * @return string
108
     */
109
    public function getName()
110
    {
111
        return $this->name;
112
    }
113
114
    /**
115
     * Cette méthode permet de faire "echo $familyLog".
116
     * <p>Ainsi, pour "afficher" $familyLog,
117
     * PHP affichera en réalité le retour de cette méthode.<br />
118
     * Ici, le nom, donc "echo $familyLog"
119
     * est équivalent à "echo $familyLog->getName()"</p>.
120
     *
121
     * @return string name
122
     */
123
    public function __toString()
124
    {
125
        return $this->name;
126
    }
127
128
    /**
129
     * Get slug
130
     *
131
     * @return string
132
     */
133
    public function getSlug()
134
    {
135
        return $this->slug;
136
    }
137
138
    /**
139
     * Set parent
140
     *
141
     * @param \AppBundle\Entity\FamilyLog $parent
142
     * @return FamilyLog
143
     */
144
    public function setParent(\AppBundle\Entity\FamilyLog $parent = null)
145
    {
146
        $this->parent = $parent;
147
148
        return $this;
149
    }
150
151
    /**
152
     * Get parent
153
     *
154
     * @return \AppBundle\Entity\FamilyLog 
155
     */
156
    public function getParent()
157
    {
158
        return $this->parent;
159
    }
160
161
    /**
162
     * Add children
163
     *
164
     * @param \AppBundle\Entity\FamilyLog $children
165
     * @return FamilyLog
166
     */
167
    public function addChild(\AppBundle\Entity\FamilyLog $children)
168
    {
169
        $this->children[] = $children;
170
171
        return $this;
172
    }
173
174
    /**
175
     * Remove children
176
     *
177
     * @param \AppBundle\Entity\FamilyLog $children
178
     */
179
    public function removeChild(\AppBundle\Entity\FamilyLog $children)
180
    {
181
        $this->children->removeElement($children);
182
    }
183
184
    /**
185
     * Get children
186
     *
187
     * @return \Doctrine\Common\Collections\Collection 
188
     */
189
    public function getChildren()
190
    {
191
        return $this->children;
192
    }
193
    /**
194
     * Constructor
195
     */
196
    public function __construct()
197
    {
198
        $this->children = new \Doctrine\Common\Collections\ArrayCollection();
199
    }
200
201
    /**
202
     * Set path
203
     *
204
     * @param string $path
205
     * @return FamilyLog
206
     */
207
    public function setPath($path)
208
    {
209
        $this->path = $path;
210
211
        return $this;
212
    }
213
214
    /**
215
     * Get path
216
     *
217
     * @return string 
218
     */
219
    public function getPath()
220
    {
221
        return $this->path;
222
    }
223
224
    /**
225
     * Set level
226
     *
227
     * @param integer $level
228
     * @return FamilyLog
229
     */
230
    public function setLevel($level)
231
    {
232
        $this->level = $level;
233
234
        return $this;
235
    }
236
237
    /**
238
     * Get level
239
     *
240
     * @return integer 
241
     */
242
    public function getLevel()
243
    {
244
        return $this->level;
245
    }
246
}
247