|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
ÁTICA - Aplicación web para la gestión documental de centros educativos |
|
4
|
|
|
|
|
5
|
|
|
Copyright (C) 2015-2016: Luis Ramón López López |
|
6
|
|
|
|
|
7
|
|
|
This program is free software: you can redistribute it and/or modify |
|
8
|
|
|
it under the terms of the GNU Affero General Public License as published by |
|
9
|
|
|
the Free Software Foundation, either version 3 of the License, or |
|
10
|
|
|
(at your option) any later version. |
|
11
|
|
|
|
|
12
|
|
|
This program is distributed in the hope that it will be useful, |
|
13
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
GNU Affero General Public License for more details. |
|
16
|
|
|
|
|
17
|
|
|
You should have received a copy of the GNU Affero General Public License |
|
18
|
|
|
along with this program. If not, see [http://www.gnu.org/licenses/]. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppBundle\Entity; |
|
22
|
|
|
|
|
23
|
|
|
use Doctrine\Common\Collections\Collection; |
|
24
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @ORM\Entity |
|
28
|
|
|
*/ |
|
29
|
|
|
class Teacher |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @ORM\Id |
|
33
|
|
|
* @ORM\OneToOne(targetEntity="Person") |
|
34
|
|
|
* @ORM\JoinColumn(name="id") |
|
35
|
|
|
* @var Person |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $person; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @ORM\ManyToMany(targetEntity="Group", mappedBy="tutors") |
|
41
|
|
|
* @var Collection |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $tutorizedGroups; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @ORM\OneToMany(targetEntity="Department", mappedBy="head") |
|
47
|
|
|
* @var Collection |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $directs; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @ORM\OneToMany(targetEntity="Agreement", mappedBy="educationalTutor") |
|
53
|
|
|
* @var Collection |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $agreements; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Constructor |
|
59
|
|
|
*/ |
|
60
|
|
|
public function __construct() |
|
61
|
|
|
{ |
|
62
|
|
|
$this->tutorizedGroups = new \Doctrine\Common\Collections\ArrayCollection(); |
|
63
|
|
|
$this->directs = new \Doctrine\Common\Collections\ArrayCollection(); |
|
64
|
|
|
$this->agreements = new \Doctrine\Common\Collections\ArrayCollection(); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Returns the teachers's display name |
|
69
|
|
|
* |
|
70
|
|
|
* @return string |
|
71
|
|
|
*/ |
|
72
|
|
|
public function __toString() |
|
73
|
|
|
{ |
|
74
|
|
|
return (string) $this->person; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Set person |
|
79
|
|
|
* |
|
80
|
|
|
* @param Person $person |
|
81
|
|
|
* |
|
82
|
|
|
* @return Teacher |
|
83
|
|
|
*/ |
|
84
|
|
|
public function setPerson(Person $person) |
|
85
|
|
|
{ |
|
86
|
|
|
$this->person = $person; |
|
87
|
|
|
|
|
88
|
|
|
return $this; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Get person |
|
93
|
|
|
* |
|
94
|
|
|
* @return Person |
|
95
|
|
|
*/ |
|
96
|
|
|
public function getPerson() |
|
97
|
|
|
{ |
|
98
|
|
|
return $this->person; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Add tutorizedGroup |
|
103
|
|
|
* |
|
104
|
|
|
* @param Group $tutorizedGroup |
|
105
|
|
|
* |
|
106
|
|
|
* @return Teacher |
|
107
|
|
|
*/ |
|
108
|
|
|
public function addTutorizedGroup(Group $tutorizedGroup) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->tutorizedGroups[] = $tutorizedGroup; |
|
111
|
|
|
|
|
112
|
|
|
return $this; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* Remove tutorizedGroup |
|
117
|
|
|
* |
|
118
|
|
|
* @param Group $tutorizedGroup |
|
119
|
|
|
*/ |
|
120
|
|
|
public function removeTutorizedGroup(Group $tutorizedGroup) |
|
121
|
|
|
{ |
|
122
|
|
|
$this->tutorizedGroups->removeElement($tutorizedGroup); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* Get tutorizedGroups |
|
127
|
|
|
* |
|
128
|
|
|
* @return Collection |
|
129
|
|
|
*/ |
|
130
|
|
|
public function getTutorizedGroups() |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->tutorizedGroups; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Add direct |
|
137
|
|
|
* |
|
138
|
|
|
* @param Department $direct |
|
139
|
|
|
* |
|
140
|
|
|
* @return Teacher |
|
141
|
|
|
*/ |
|
142
|
|
|
public function addDirect(Department $direct) |
|
143
|
|
|
{ |
|
144
|
|
|
$this->directs[] = $direct; |
|
145
|
|
|
|
|
146
|
|
|
return $this; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Remove direct |
|
151
|
|
|
* |
|
152
|
|
|
* @param Department $direct |
|
153
|
|
|
*/ |
|
154
|
|
|
public function removeDirect(Department $direct) |
|
155
|
|
|
{ |
|
156
|
|
|
$this->directs->removeElement($direct); |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* Get directs |
|
161
|
|
|
* |
|
162
|
|
|
* @return Collection |
|
163
|
|
|
*/ |
|
164
|
|
|
public function getDirects() |
|
165
|
|
|
{ |
|
166
|
|
|
return $this->directs; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* Add agreement |
|
171
|
|
|
* |
|
172
|
|
|
* @param Agreement $agreement |
|
173
|
|
|
* |
|
174
|
|
|
* @return Teacher |
|
175
|
|
|
*/ |
|
176
|
|
|
public function addAgreement(Agreement $agreement) |
|
177
|
|
|
{ |
|
178
|
|
|
$this->agreements[] = $agreement; |
|
179
|
|
|
|
|
180
|
|
|
return $this; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* Remove agreement |
|
185
|
|
|
* |
|
186
|
|
|
* @param Agreement $agreement |
|
187
|
|
|
*/ |
|
188
|
|
|
public function removeAgreement(Agreement $agreement) |
|
189
|
|
|
{ |
|
190
|
|
|
$this->agreements->removeElement($agreement); |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* Get agreements |
|
195
|
|
|
* |
|
196
|
|
|
* @return Collection |
|
197
|
|
|
*/ |
|
198
|
|
|
public function getAgreements() |
|
199
|
|
|
{ |
|
200
|
|
|
return $this->agreements; |
|
201
|
|
|
} |
|
202
|
|
|
} |
|
203
|
|
|
|