src/Entity/Evaluation.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Course;
  4. use App\Entity\SchoolYear;
  5. use App\Entity\Attribution;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\Entity\Traits\TimeStampable;
  9. use Doctrine\Persistence\ObjectManager;
  10. use App\Repository\EvaluationRepository;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\Persistence\Mapping\ClassMetadata;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. /**
  16. * @ORM\Entity(repositoryClass=EvaluationRepository::class)
  17. */
  18. class Evaluation
  19. {
  20. use TimeStampable;
  21. public const NUM_ITEMS_PER_PAGE = 20;
  22. /**
  23. * @ORM\Id
  24. * @ORM\GeneratedValue
  25. * @ORM\Column(type="integer")
  26. */
  27. private $id;
  28. /**
  29. * @ORM\ManyToOne(targetEntity=Sequence::class, inversedBy="evaluations")
  30. * @ORM\JoinColumn(nullable=false)
  31. */
  32. private $sequence;
  33. /**
  34. * @ORM\Column(type="float")
  35. */
  36. private $moyenne;
  37. /**
  38. * @ORM\Column(type="text", nullable=true)
  39. */
  40. private $competence;
  41. /**
  42. * @ORM\Column(type="integer", options={"default":0})
  43. */
  44. private $abscent;
  45. /**
  46. * @ORM\Column(type="integer" , options={"default":0})
  47. */
  48. private $successH;
  49. /**
  50. * @ORM\Column(type="integer", options={"default":0})
  51. */
  52. private $successF;
  53. /**
  54. * @ORM\Column(type="integer", options={"default":0})
  55. */
  56. private $failluresH;
  57. /**
  58. * @ORM\Column(type="integer", options={"default":0})
  59. */
  60. private $failluresF;
  61. /**
  62. * @ORM\Column(type="float", options={"default":0})
  63. */
  64. private $mini;
  65. /**
  66. * @ORM\Column(type="float", options={"default":20})
  67. */
  68. private $maxi;
  69. /**
  70. * @ORM\ManyToOne(targetEntity=Course::class, inversedBy="evaluations")
  71. * @ORM\JoinColumn(nullable=false)
  72. */
  73. private $course;
  74. /**
  75. * @ORM\ManyToOne(targetEntity=ClassRoom::class)
  76. * @ORM\JoinColumn(nullable=false)
  77. */
  78. private $classRoom;
  79. /**
  80. * @ORM\ManyToOne(targetEntity=User::class)
  81. * @ORM\JoinColumn(nullable=true)
  82. */
  83. private $author;
  84. /**
  85. * @ORM\OneToMany(targetEntity=Mark::class, mappedBy="evaluation", orphanRemoval=true)
  86. */
  87. private $marks;
  88. public function __construct()
  89. {
  90. $this->marks = new ArrayCollection();
  91. $this->setFailluresF(0);
  92. $this->setFailluresH(0);
  93. $this->setSuccessF(0);
  94. $this->setSuccessH(0);
  95. $this->setAbscent(0);
  96. $this->createdAt= new \DateTime();
  97. $this->updatedAt= new \DateTime();
  98. }
  99. public function injectObjectManager(
  100. ObjectManager $objectManager,
  101. ClassMetadata $classMetadata
  102. ) {
  103. $this->em = $objectManager;
  104. }
  105. public function getId(): ?int
  106. {
  107. return $this->id;
  108. }
  109. public function getSequence(): ?Sequence
  110. {
  111. return $this->sequence;
  112. }
  113. public function setSequence(?Sequence $sequence): self
  114. {
  115. $this->sequence = $sequence;
  116. return $this;
  117. }
  118. public function getMoyenne(): ?float
  119. {
  120. return $this->moyenne;
  121. }
  122. public function setMoyenne(float $moyenne): self
  123. {
  124. $this->moyenne = $moyenne;
  125. return $this;
  126. }
  127. public function getCompetence(): ?string
  128. {
  129. return $this->competence;
  130. }
  131. public function setCompetence(?string $competence): self
  132. {
  133. $this->competence = $competence;
  134. return $this;
  135. }
  136. public function getAbscent(): ?int
  137. {
  138. return $this->abscent;
  139. }
  140. public function setAbscent(int $abscent): self
  141. {
  142. $this->abscent = $abscent;
  143. return $this;
  144. }
  145. public function getSuccessH(): ?int
  146. {
  147. return $this->successH;
  148. }
  149. public function setSuccessH(int $successH): self
  150. {
  151. $this->successH = $successH;
  152. return $this;
  153. }
  154. public function getSuccessF(): ?int
  155. {
  156. return $this->successF;
  157. }
  158. public function setSuccessF(int $successF): self
  159. {
  160. $this->successF = $successF;
  161. return $this;
  162. }
  163. public function getFailluresH(): ?int
  164. {
  165. return $this->failluresH;
  166. }
  167. public function setFailluresH(int $failluresH): self
  168. {
  169. $this->failluresH = $failluresH;
  170. return $this;
  171. }
  172. public function getFailluresF(): ?int
  173. {
  174. return $this->failluresF;
  175. }
  176. public function setFailluresF(int $failluresF): self
  177. {
  178. $this->failluresF = $failluresF;
  179. return $this;
  180. }
  181. /**
  182. * Set successF
  183. *
  184. *
  185. * @return Evaluation
  186. */
  187. public function addSuccessF()
  188. {
  189. $this->successF++;
  190. return $this;
  191. }
  192. /**
  193. * Set successF
  194. *
  195. *
  196. * @return Evaluation
  197. */
  198. public function addSuccessH()
  199. {
  200. $this->successH++;
  201. return $this;
  202. }
  203. /**
  204. * Add failluresF
  205. *
  206. *
  207. * @return Evaluation
  208. */
  209. public function addFailluresH()
  210. {
  211. $this->failluresH++;
  212. return $this;
  213. }
  214. /**
  215. * Add Abscent
  216. *
  217. *
  218. * @return Evaluation
  219. */
  220. public function addAbscent()
  221. {
  222. $this->abscent++;
  223. return $this;
  224. }
  225. /**
  226. * Set failluresF
  227. *
  228. * @param integer $failluresF
  229. *
  230. * @return Evaluation
  231. */
  232. public function addFailluresF()
  233. {
  234. $this->failluresF++;
  235. return $this;
  236. }
  237. public function getCourse(): ?Course
  238. {
  239. return $this->course;
  240. }
  241. public function setCourse(?Course $course): self
  242. {
  243. $this->course = $course;
  244. return $this;
  245. }
  246. public function getClassRoom(): ?ClassRoom
  247. {
  248. return $this->classRoom;
  249. }
  250. public function setClassRoom(?ClassRoom $classRoom): self
  251. {
  252. $this->classRoom = $classRoom;
  253. return $this;
  254. }
  255. /**
  256. * @return Collection|Mark[]
  257. */
  258. public function getMarks(): Collection
  259. {
  260. return $this->marks;
  261. }
  262. public function addMark(Mark $mark): self
  263. {
  264. if (!$this->marks->contains($mark)) {
  265. $this->marks[] = $mark;
  266. $mark->setEvaluation($this);
  267. }
  268. return $this;
  269. }
  270. public function removeMark(Mark $mark): self
  271. {
  272. if ($this->marks->removeElement($mark)) {
  273. // set the owning side to null (unless already changed)
  274. if ($mark->getEvaluation() === $this) {
  275. $mark->setEvaluation(null);
  276. }
  277. }
  278. return $this;
  279. }
  280. public function getAuthor(): ?User
  281. {
  282. return $this->author;
  283. }
  284. public function setAuthor(?User $author): static
  285. {
  286. $this->author = $author;
  287. return $this;
  288. }
  289. public function getMini(): ?float
  290. {
  291. return $this->mini;
  292. }
  293. public function setMini(float $mini): static
  294. {
  295. $this->mini = $mini;
  296. return $this;
  297. }
  298. public function getMaxi(): ?float
  299. {
  300. return $this->maxi;
  301. }
  302. public function setMaxi(float $maxi): static
  303. {
  304. $this->maxi = $maxi;
  305. return $this;
  306. }
  307. }