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.     /**
  63.      * @ORM\Column(type="float", options={"default":0})
  64.      */
  65.     private $mini;
  66.     /**
  67.      * @ORM\Column(type="float", options={"default":20})
  68.      */
  69.     private $maxi;
  70.     /**
  71.      * @ORM\ManyToOne(targetEntity=Course::class, inversedBy="evaluations")
  72.      * @ORM\JoinColumn(nullable=false)
  73.      */
  74.     private $course;
  75.     /**
  76.      * @ORM\ManyToOne(targetEntity=ClassRoom::class)
  77.      * @ORM\JoinColumn(nullable=false)
  78.      */
  79.     private $classRoom;
  80.     /**
  81.      * @ORM\ManyToOne(targetEntity=User::class)
  82.      * @ORM\JoinColumn(nullable=true)
  83.      */
  84.     private $author;
  85.     
  86.    
  87.     /**
  88.      * @ORM\OneToMany(targetEntity=Mark::class, mappedBy="evaluation", orphanRemoval=true)
  89.      */
  90.     private $marks;
  91.     public function __construct()
  92.     {
  93.         $this->marks = new ArrayCollection();
  94.         $this->setFailluresF(0);
  95.         $this->setFailluresH(0);
  96.         $this->setSuccessF(0);
  97.         $this->setSuccessH(0);
  98.         $this->setAbscent(0);
  99.         $this->createdAt= new \DateTime();
  100.         $this->updatedAt= new \DateTime();
  101.        
  102.     }
  103.     public function injectObjectManager(
  104.         ObjectManager $objectManager,
  105.         ClassMetadata $classMetadata
  106.     ) {
  107.         $this->em $objectManager;
  108.     }
  109.     
  110.     
  111.  
  112.     public function getId(): ?int
  113.     {
  114.         return $this->id;
  115.     }
  116.     public function getSequence(): ?Sequence
  117.     {
  118.         return $this->sequence;
  119.     }
  120.     public function setSequence(?Sequence $sequence): self
  121.     {
  122.         $this->sequence $sequence;
  123.         return $this;
  124.     }
  125.     public function getMoyenne(): ?float
  126.     {
  127.         return $this->moyenne;
  128.     }
  129.     
  130.     public function setMoyenne(float $moyenne): self
  131.     {
  132.         $this->moyenne $moyenne;
  133.         return $this;
  134.     }
  135.     public function getCompetence(): ?string
  136.     {
  137.         return $this->competence;
  138.     }
  139.     public function setCompetence(?string $competence): self
  140.     {
  141.         $this->competence $competence;
  142.         return $this;
  143.     }
  144.     public function getAbscent(): ?int
  145.     {
  146.         return $this->abscent;
  147.     }
  148.     public function setAbscent(int $abscent): self
  149.     {
  150.         $this->abscent $abscent;
  151.         return $this;
  152.     }
  153.     public function getSuccessH(): ?int
  154.     {
  155.         return $this->successH;
  156.     }
  157.     public function setSuccessH(int $successH): self
  158.     {
  159.         $this->successH $successH;
  160.         return $this;
  161.     }
  162.     public function getSuccessF(): ?int
  163.     {
  164.         return $this->successF;
  165.     }
  166.     public function setSuccessF(int $successF): self
  167.     {
  168.         $this->successF $successF;
  169.         return $this;
  170.     }
  171.     public function getFailluresH(): ?int
  172.     {
  173.         return $this->failluresH;
  174.     }
  175.     public function setFailluresH(int $failluresH): self
  176.     {
  177.         $this->failluresH $failluresH;
  178.         return $this;
  179.     }
  180.     public function getFailluresF(): ?int
  181.     {
  182.         return $this->failluresF;
  183.     }
  184.     public function setFailluresF(int $failluresF): self
  185.     {
  186.         $this->failluresF $failluresF;
  187.         return $this;
  188.     }
  189.         /**
  190.     * Set successF
  191.     *
  192.     *
  193.     * @return Evaluation
  194.     */
  195.     public function addSuccessF()
  196.     {
  197.         $this->successF++;
  198.         return $this;
  199.     }
  200.   
  201.        /**
  202.     * Set successF
  203.     *
  204.     *
  205.     * @return Evaluation
  206.     */
  207.     public function addSuccessH()
  208.     {
  209.         $this->successH++;
  210.         return $this;
  211.     }
  212.     /**
  213.     * Add failluresF
  214.     *
  215.     *
  216.     * @return Evaluation
  217.     */
  218.     public function addFailluresH()
  219.     {
  220.         $this->failluresH++;
  221.         return $this;
  222.     }
  223.   
  224.      /**
  225.     * Add Abscent
  226.     *
  227.     *
  228.     * @return Evaluation
  229.     */
  230.     public function addAbscent()
  231.     {
  232.         $this->abscent++;
  233.         return $this;
  234.     }
  235.       /**
  236.      * Set failluresF
  237.      *
  238.      * @param integer $failluresF
  239.      *
  240.      * @return Evaluation
  241.      */
  242.     public function addFailluresF()
  243.     {
  244.         $this->failluresF++;
  245.         return $this;
  246.     }
  247.     
  248.     public function getCourse(): ?Course
  249.     {
  250.         return $this->course;
  251.     }
  252.     public function setCourse(?Course $course): self
  253.     {
  254.         $this->course $course;
  255.         return $this;
  256.     }
  257.     public function getClassRoom(): ?ClassRoom
  258.     {
  259.         return $this->classRoom;
  260.     }
  261.     public function setClassRoom(?ClassRoom $classRoom): self
  262.     {
  263.         $this->classRoom $classRoom;
  264.         return $this;
  265.     }
  266.     /**
  267.      * @return Collection|Mark[]
  268.      */
  269.     public function getMarks(): Collection
  270.     {
  271.         return $this->marks;
  272.     }
  273.     public function addMark(Mark $mark): self
  274.     {
  275.         if (!$this->marks->contains($mark)) {
  276.             $this->marks[] = $mark;
  277.             $mark->setEvaluation($this);
  278.         }
  279.         return $this;
  280.     }
  281.     public function removeMark(Mark $mark): self
  282.     {
  283.         if ($this->marks->removeElement($mark)) {
  284.             // set the owning side to null (unless already changed)
  285.             if ($mark->getEvaluation() === $this) {
  286.                 $mark->setEvaluation(null);
  287.             }
  288.         }
  289.         return $this;
  290.     }
  291.     public function getAuthor(): ?User
  292.     {
  293.         return $this->author;
  294.     }
  295.     public function setAuthor(?User $author): static
  296.     {
  297.         $this->author $author;
  298.         return $this;
  299.     }
  300.     public function getMini(): ?float
  301.     {
  302.         return $this->mini;
  303.     }
  304.     public function setMini(float $mini): static
  305.     {
  306.         $this->mini $mini;
  307.         return $this;
  308.     }
  309.     public function getMaxi(): ?float
  310.     {
  311.         return $this->maxi;
  312.     }
  313.     public function setMaxi(float $maxi): static
  314.     {
  315.         $this->maxi $maxi;
  316.         return $this;
  317.     }
  318. }