src/Entity/Note.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\NoteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassNoteRepository::class)]
  9. class Note
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length255)]
  16.     private $organization;
  17.     #[ORM\Column(type'string'length255)]
  18.     private $education;
  19.     #[ORM\Column(type'text'nullabletrue)]
  20.     private $comment;
  21.     #[ORM\OneToOne(targetEntityBooking::class, inversedBy'note'cascade: ['persist''remove'])]
  22.     private $booking;
  23.     #[ORM\ManyToOne(targetEntityProInfo::class, inversedBy'notes')]
  24.     private $pro;
  25.     #[ORM\Column(type'datetime')]
  26.     private $createdAt;
  27.     #[ORM\ManyToMany(targetEntityUser::class, inversedBy'notes')]
  28.     private Collection $associatedPros;
  29.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  30.     private ?string $response null;
  31.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  32.     private ?\DateTimeInterface $repliedAt null;
  33.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  34.     private ?\DateTimeInterface $lastReminder null;
  35.     #[ORM\ManyToOne(inversedBy'notes')]
  36.     private ?Course $course null;
  37.     #[ORM\ManyToOne(inversedBy'notes')]
  38.     private ?Trainee $trainee null;
  39.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  40.     private ?NoteRequest $noteRequest null;
  41.     public function __construct()
  42.     {
  43.         $this->associatedPros = new ArrayCollection();
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getOrganization(): ?string
  50.     {
  51.         return $this->organization;
  52.     }
  53.     public function setOrganization(string $organization): self
  54.     {
  55.         $this->organization $organization;
  56.         return $this;
  57.     }
  58.     public function getEducation(): ?string
  59.     {
  60.         return $this->education;
  61.     }
  62.     public function setEducation(string $education): self
  63.     {
  64.         $this->education $education;
  65.         return $this;
  66.     }
  67.     public function getComment(): ?string
  68.     {
  69.         return $this->comment;
  70.     }
  71.     public function setComment(?string $comment): self
  72.     {
  73.         $this->comment $comment;
  74.         return $this;
  75.     }
  76.     public function getBooking(): ?Booking
  77.     {
  78.         return $this->booking;
  79.     }
  80.     public function setBooking(?Booking $booking): self
  81.     {
  82.         $this->booking $booking;
  83.         return $this;
  84.     }
  85.     public function getPro(): ?ProInfo
  86.     {
  87.         return $this->pro;
  88.     }
  89.     public function setPro(?ProInfo $pro): self
  90.     {
  91.         $this->pro $pro;
  92.         return $this;
  93.     }
  94.     public function getCreatedAt(): ?\DateTimeInterface
  95.     {
  96.         return $this->createdAt;
  97.     }
  98.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  99.     {
  100.         $this->createdAt $createdAt;
  101.         return $this;
  102.     }
  103.     public function getTotalNote()
  104.     {
  105.         $total 0;
  106.         $number 0;
  107.         $total += $this->getOrganization();
  108.         $number++;
  109.         $total += $this->getEducation();
  110.         $number++;
  111.         if ($number != 0) {
  112.             $average number_format((float)($total $number), 1'.''');
  113.             return $average;
  114.         } 
  115.         else 
  116.         {
  117.             return null;
  118.         }
  119.     }
  120.     /**
  121.      * @return Collection<int, User>
  122.      */
  123.     public function getAssociatedPros(): Collection
  124.     {
  125.         return $this->associatedPros;
  126.     }
  127.     public function addAssociatedPro(User $associatedPro): static
  128.     {
  129.         if (!$this->associatedPros->contains($associatedPro)) {
  130.             $this->associatedPros->add($associatedPro);
  131.         }
  132.         return $this;
  133.     }
  134.     public function removeAssociatedPro(User $associatedPro): static
  135.     {
  136.         $this->associatedPros->removeElement($associatedPro);
  137.         return $this;
  138.     }
  139.     public function getResponse(): ?string
  140.     {
  141.         return $this->response;
  142.     }
  143.     public function setResponse(?string $response): static
  144.     {
  145.         $this->response $response;
  146.         return $this;
  147.     }
  148.     public function getRepliedAt(): ?\DateTimeInterface
  149.     {
  150.         return $this->repliedAt;
  151.     }
  152.     public function setRepliedAt(?\DateTimeInterface $repliedAt): static
  153.     {
  154.         $this->repliedAt $repliedAt;
  155.         return $this;
  156.     }
  157.     public function getLastReminder(): ?\DateTimeInterface
  158.     {
  159.         return $this->lastReminder;
  160.     }
  161.     public function setLastReminder(?\DateTimeInterface $lastReminder): static
  162.     {
  163.         $this->lastReminder $lastReminder;
  164.         return $this;
  165.     }
  166.     public function getCourse(): ?Course
  167.     {
  168.         return $this->course;
  169.     }
  170.     public function setCourse(?Course $course): static
  171.     {
  172.         $this->course $course;
  173.         return $this;
  174.     }
  175.     public function getTrainee(): ?Trainee
  176.     {
  177.         return $this->trainee;
  178.     }
  179.     public function setTrainee(?Trainee $trainee): static
  180.     {
  181.         $this->trainee $trainee;
  182.         return $this;
  183.     }
  184.     public function getNoteRequest(): ?NoteRequest
  185.     {
  186.         return $this->noteRequest;
  187.     }
  188.     public function setNoteRequest(?NoteRequest $noteRequest): static
  189.     {
  190.         $this->noteRequest $noteRequest;
  191.         return $this;
  192.     }
  193. }