CriteriaNotation.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <?php
  2. namespace AppBundle\Entity\Education;
  3. use AppBundle\Entity\Organization\Organization;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Dunglas\ApiBundle\Annotation\Iri;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use AppBundle\Entity\Traits\TimestampableEntity;
  10. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  11. use AppBundle\Annotation\DefaultField;
  12. /**
  13. * Critère d'évaluation permettant de définir un suivi pédagogique EducationNotation
  14. *
  15. * @Iri("http://schema.org/CriteriaNotation")
  16. */
  17. #[ORM\Entity]
  18. class CriteriaNotation
  19. {
  20. use TimestampableEntity;
  21. use CreatorUpdaterEntity;
  22. /**
  23. * @var int
  24. */
  25. #[ORM\Column(type: 'integer')]
  26. #[ORM\Id]
  27. #[ORM\GeneratedValue(strategy: 'AUTO')]
  28. #[Groups(['criterianotation', 'report_card_educationstudent', 'educationnotation_list', 'criteria_notations_list'])]
  29. private $id;
  30. /**
  31. * @var Organization
  32. *
  33. * @DefaultField
  34. */
  35. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'critereNotations')]
  36. #[ORM\JoinColumn(nullable: false)]
  37. #[Assert\NotNull]
  38. #[Groups(['criterianotation'])]
  39. private $organization;
  40. /**
  41. * @var string
  42. */
  43. #[ORM\Column(type: 'string')]
  44. #[Assert\Type(type: 'string')]
  45. #[Assert\NotNull]
  46. #[Groups(['criterianotation', 'criterianotation_reference', 'report_card_educationstudent', 'educationnotation_list_criterianotation', 'education_input_list_educationnotations', 'criteria_notations_list'])]
  47. private $label;
  48. /**
  49. * @var string
  50. */
  51. #[ORM\Column(type: 'text', nullable: true)]
  52. #[Assert\Type(type: 'string')]
  53. #[Groups(['criterianotation'])]
  54. private $description;
  55. /**
  56. * @var ArrayCollection<EducationNotation>
  57. */
  58. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\EducationNotation', mappedBy: 'criteriaNotation')]
  59. #[Groups(['criterianotation_educationnotation'])]
  60. private $educationNotations;
  61. /**
  62. * @var bool
  63. */
  64. #[ORM\Column(type: 'boolean', options: ['default' => true])]
  65. #[Assert\Type(type: 'boolean')]
  66. #[Assert\NotNull]
  67. #[Groups(['criterianotation', 'criterianotation_reference', 'criteria_notations_list'])]
  68. private $isActive = true;
  69. /**
  70. * @var string
  71. */
  72. #[ORM\Column(type: 'string', nullable: true)]
  73. #[Assert\Choice(callback: ['\AppBundle\Enum\Education\TypeCriteriaEnum', 'toArray'], multiple: false)]
  74. #[Groups(['criterianotation', 'criterianotation_reference', 'educationnotation_list_criterianotation', 'report_card_educationstudent', 'criteria_notations_list'])]
  75. private $type;
  76. /**
  77. * @var int
  78. */
  79. #[ORM\Column(type: 'integer', nullable: true)]
  80. #[Assert\Type(type: 'integer', message: 'invalid-integer')]
  81. #[Assert\GreaterThanOrEqual(value: 0)]
  82. #[Assert\LessThanOrEqual(value: 100, message: 'lessThanOrEqual100')]
  83. #[Groups(['criterianotation', 'criterianotation_reference', 'report_card_educationstudent', 'educationnotation_list_criterianotation', 'criteria_notations_list'])]
  84. private $noteMax;
  85. /**
  86. * @var ArrayCollection<EducationNotation>
  87. */
  88. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\CustomNotation', mappedBy: 'criteriaNotation', orphanRemoval: true, cascade: ['persist', 'remove'])]
  89. #[Groups(['criterianotation', 'criterianotation_reference', 'criteria_notations_list'])]
  90. private $customNotation;
  91. /**
  92. * @var ArrayCollection<EducationNotationCriteriaConfig>
  93. */
  94. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\EducationNotationCriteriaConfig', mappedBy: 'criteriaNotation', orphanRemoval: true, cascade: ['persist', 'remove'])]
  95. #[Groups(['educationnotationconfig'])]
  96. private $educationNotationCriteriaConfigs;
  97. /**
  98. * Constructor
  99. */
  100. public function __construct()
  101. {
  102. $this->educationNotations = new ArrayCollection();
  103. $this->customNotation = new ArrayCollection();
  104. $this->educationNotationCriteriaConfigs = new ArrayCollection();
  105. }
  106. /**
  107. * Sets id.
  108. *
  109. * @param int $id
  110. *
  111. * @return $this
  112. */
  113. public function setId($id)
  114. {
  115. $this->id = $id;
  116. return $this;
  117. }
  118. /**
  119. * Gets id.
  120. *
  121. * @return int
  122. */
  123. public function getId()
  124. {
  125. return $this->id;
  126. }
  127. /**
  128. * Sets organization.
  129. *
  130. * @param Organization $organization
  131. *
  132. * @return $this
  133. */
  134. public function setOrganization(Organization $organization)
  135. {
  136. $this->organization = $organization;
  137. return $this;
  138. }
  139. /**
  140. * Gets organization.
  141. *
  142. * @return Organization
  143. */
  144. public function getOrganization()
  145. {
  146. return $this->organization;
  147. }
  148. /**
  149. * Sets label.
  150. *
  151. * @param string $label
  152. *
  153. * @return $this
  154. */
  155. public function setLabel($label)
  156. {
  157. $this->label = $label;
  158. return $this;
  159. }
  160. /**
  161. * Gets label.
  162. *
  163. * @return string
  164. */
  165. public function getLabel()
  166. {
  167. return $this->label;
  168. }
  169. /**
  170. * Sets description.
  171. *
  172. * @param string $description
  173. *
  174. * @return $this
  175. */
  176. public function setDescription($description)
  177. {
  178. $this->description = $description;
  179. return $this;
  180. }
  181. /**
  182. * Gets description.
  183. *
  184. * @return string
  185. */
  186. public function getDescription()
  187. {
  188. return $this->description;
  189. }
  190. /**
  191. * Add educationNotation
  192. *
  193. * @param \AppBundle\Entity\Education\EducationNotation $educationNotation
  194. *
  195. * @return CriteriaNotation
  196. */
  197. public function addEducationNotation(\AppBundle\Entity\Education\EducationNotation $educationNotation)
  198. {
  199. $this->educationNotations[] = $educationNotation;
  200. return $this;
  201. }
  202. /**
  203. * Remove educationNotation
  204. *
  205. * @param \AppBundle\Entity\Education\EducationNotation $educationNotation
  206. */
  207. public function removeEducationNotation(\AppBundle\Entity\Education\EducationNotation $educationNotation)
  208. {
  209. $this->educationNotations->removeElement($educationNotation);
  210. }
  211. /**
  212. * Get educationNotations
  213. *
  214. * @return \Doctrine\Common\Collections\Collection
  215. */
  216. public function getEducationNotations()
  217. {
  218. return $this->educationNotations;
  219. }
  220. /**
  221. * Set isActive
  222. *
  223. * @param boolean $isActive
  224. *
  225. * @return CriteriaNotation
  226. */
  227. public function setIsActive($isActive)
  228. {
  229. $this->isActive = $isActive;
  230. return $this;
  231. }
  232. /**
  233. * Get isActive
  234. *
  235. * @return boolean
  236. */
  237. public function getIsActive()
  238. {
  239. return $this->isActive;
  240. }
  241. /**
  242. * @return string
  243. */
  244. public function getType()
  245. {
  246. return $this->type;
  247. }
  248. /**
  249. * @param string $type
  250. */
  251. public function setType($type)
  252. {
  253. $this->type = $type;
  254. }
  255. /**
  256. * @return int
  257. */
  258. public function getNoteMax()
  259. {
  260. return $this->noteMax;
  261. }
  262. /**
  263. * @param int $noteMax
  264. */
  265. public function setNoteMax($noteMax)
  266. {
  267. $this->noteMax = $noteMax;
  268. }
  269. /**
  270. * @return CustomNotation
  271. */
  272. public function getCustomNotation()
  273. {
  274. return $this->customNotation;
  275. }
  276. /**
  277. * Add customNotation
  278. *
  279. * @param CustomNotation $customNotation
  280. *
  281. * @return CriteriaNotation
  282. */
  283. public function addCustomNotation(CustomNotation $customNotation)
  284. {
  285. $customNotation->setCriteriaNotation($this);
  286. $this->customNotation[] = $customNotation;
  287. return $this;
  288. }
  289. /**
  290. * Remove customNotation
  291. *
  292. * @param CustomNotation $customNotation
  293. */
  294. public function removeCustomNotation(CustomNotation $customNotation)
  295. {
  296. $customNotation->setCriteriaNotation(null);
  297. $this->customNotation->removeElement($customNotation);
  298. }
  299. /**
  300. * @return ArrayCollection<EducationNotationCriteriaConfig>
  301. *
  302. */
  303. public function getEducationNotationCriteriaConfigs()
  304. {
  305. return $this->educationNotationCriteriaConfigs;
  306. }
  307. /**
  308. * Add educationNotationCriteriaConfig
  309. *
  310. * @param EducationNotationCriteriaConfig $educationNotationCriteriaConfigs
  311. *
  312. * @return CriteriaNotation
  313. */
  314. public function addEducationNotationCriteriaConfig(EducationNotationCriteriaConfig $educationNotationCriteriaConfigs)
  315. {
  316. $educationNotationCriteriaConfigs->setCriteriaNotation($this);
  317. $this->educationNotationCriteriaConfigs[] = $educationNotationCriteriaConfigs;
  318. return $this;
  319. }
  320. /**
  321. * Remove educationNotationCriteriaConfig
  322. *
  323. * @param EducationNotationCriteriaConfig $educationNotationCriteriaConfigs
  324. */
  325. public function removeEducationNotationCriteriaConfig(EducationNotationCriteriaConfig $educationNotationCriteriaConfigs)
  326. {
  327. $educationNotationCriteriaConfigs->setCriteriaNotation(null);
  328. $this->educationNotationCriteriaConfigs->removeElement($educationNotationCriteriaConfigs);
  329. }
  330. }