src/Entity/AppraisalForm.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClass'App\Repository\AppraisalFormRepository')]
  9. class AppraisalForm
  10. {
  11.     #[Groups(['LogService'])]
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[Groups(['LogService''Appraisal'])]
  17.     #[ORM\Column(type'string'length255nullabletrue)]
  18.     private $title;
  19.     #[Groups(['LogService''Appraisal'])]
  20.     #[ORM\Column(type'text'nullabletrue)]
  21.     private $description;
  22.     #[Groups(['LogService'])]
  23.     #[ORM\Column(type'datetime')]
  24.     private $createdAt;
  25.     #[Groups(['LogService'])]
  26.     #[ORM\ManyToOne(targetEntity'App\Entity\user')]
  27.     #[ORM\JoinColumn(nullablefalse)]
  28.     private $createdBy;
  29.     #[ORM\ManyToOne(targetEntity'App\Entity\company'inversedBy'appraisalForms')]
  30.     #[ORM\JoinColumn(nullablefalse)]
  31.     private $company;
  32.     #[Groups(['LogService''Appraisal'])]
  33.     #[ORM\Column(type'string'length32nullabletrue)]
  34.     private $scoreMin;
  35.     #[Groups(['LogService''Appraisal'])]
  36.     #[ORM\Column(type'string'length32nullabletrue)]
  37.     private $scoreMax;
  38.     #[ORM\OneToMany(targetEntity'App\Entity\AppraisalComment'mappedBy'form'orphanRemovalfalse)]
  39.     private $appraisalComments;
  40.     #[ORM\Column(type'boolean')]
  41.     private $isHidden false;
  42.     #[ORM\ManyToOne(targetEntityoffice::class, inversedBy'appraisalForms')]
  43.     private $office;
  44.     #[ORM\Column(type'boolean'options: ['default' => true])]
  45.     private $useScore;
  46.     #[ORM\ManyToOne(targetEntityDepartment::class, inversedBy'appraisalForms')]
  47.     private $department;
  48.     #[ORM\ManyToOne(targetEntityAppraisal::class, inversedBy'appraisalForms')]
  49.     private $appraisal;
  50.     #[ORM\Column(type'string'length64nullabletrue)]
  51.     private $type;
  52.     #[ORM\ManyToOne(targetEntityUser::class)]
  53.     private $updatedBy;
  54.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  55.     private $updatedAt;
  56.     #[Groups(['Appraisal'])]
  57.     #[ORM\ManyToOne(inversedBy'questionnaire')]
  58.     private ?AppraisalCategory $appraisalCategory null;
  59.     #[ORM\Column(typeTypes::SMALLINToptions: ['default' => 0])]
  60.     private ?int $customOrder 0;
  61.     public function __construct()
  62.     {
  63.         $this->appraisalComments = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getTitle(): ?string
  70.     {
  71.         return $this->title;
  72.     }
  73.     public function setTitle(?string $title): self
  74.     {
  75.         $this->title $title;
  76.         return $this;
  77.     }
  78.     public function getDescription(): ?string
  79.     {
  80.         return $this->description;
  81.     }
  82.     public function setDescription(?string $description): self
  83.     {
  84.         $this->description $description;
  85.         return $this;
  86.     }
  87.     public function getCreatedAt(): ?\DateTimeInterface
  88.     {
  89.         return $this->createdAt;
  90.     }
  91.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  92.     {
  93.         $this->createdAt $createdAt;
  94.         return $this;
  95.     }
  96.     public function getCreatedBy(): ?user
  97.     {
  98.         return $this->createdBy;
  99.     }
  100.     public function setCreatedBy(?user $createdBy): self
  101.     {
  102.         $this->createdBy $createdBy;
  103.         return $this;
  104.     }
  105.     public function getCompany(): ?company
  106.     {
  107.         return $this->company;
  108.     }
  109.     public function setCompany(?company $company): self
  110.     {
  111.         $this->company $company;
  112.         return $this;
  113.     }
  114.     public function getScoreMin(): ?string
  115.     {
  116.         return $this->scoreMin;
  117.     }
  118.     public function setScoreMin(?string $scoreMin): self
  119.     {
  120.         $this->scoreMin $scoreMin;
  121.         return $this;
  122.     }
  123.     public function getScoreMax(): ?string
  124.     {
  125.         return $this->scoreMax;
  126.     }
  127.     public function setScoreMax(?string $scoreMax): self
  128.     {
  129.         $this->scoreMax $scoreMax;
  130.         return $this;
  131.     }
  132.     /**
  133.      * @return Collection|AppraisalComment[]
  134.      */
  135.     public function getAppraisalComments(): Collection
  136.     {
  137.         return $this->appraisalComments;
  138.     }
  139.     public function addAppraisalComment(AppraisalComment $appraisalComment): self
  140.     {
  141.         if (!$this->appraisalComments->contains($appraisalComment)) {
  142.             $this->appraisalComments[] = $appraisalComment;
  143.             $appraisalComment->setForm($this);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeAppraisalComment(AppraisalComment $appraisalComment): self
  148.     {
  149.         if ($this->appraisalComments->contains($appraisalComment)) {
  150.             $this->appraisalComments->removeElement($appraisalComment);
  151.             // set the owning side to null (unless already changed)
  152.             if ($appraisalComment->getForm() === $this) {
  153.                 $appraisalComment->setForm(null);
  154.             }
  155.         }
  156.         return $this;
  157.     }
  158.     public function currentAppraisalComments($id){
  159.         $comments = [];
  160.         foreach($this->appraisalComments as $comment){
  161.             if($comment->getAppraisal()->getId() == $id){
  162.                 array_push($comments$comment);
  163.             }
  164.         };
  165.         return $comments;
  166.     }
  167.     public function appraisalCommentsByUser($uid){
  168.         $comments = [];
  169.         foreach($this->appraisalComments as $comment){
  170.             if($comment->getUser()->getId() == $uid){
  171.                 array_push($comments$comment);
  172.             }
  173.         };
  174.         return $comments;
  175.     }
  176.     public function appraisalCommentsByOwner($fid,$uid){
  177.         foreach($this->appraisalComments as $comment){
  178.             if($comment->getAppraisal()->getId() == $fid && $comment->getUser()->getId() == $uid){
  179.                 return $comment;
  180.             }
  181.         };
  182.         return null;
  183.     }
  184.     public function getIsHidden(): ?bool
  185.     {
  186.         return $this->isHidden;
  187.     }
  188.     public function setIsHidden(bool $isHidden): self
  189.     {
  190.         $this->isHidden $isHidden;
  191.         return $this;
  192.     }
  193.     public function getOffice(): ?office
  194.     {
  195.         return $this->office;
  196.     }
  197.     public function setOffice(?office $office): self
  198.     {
  199.         $this->office $office;
  200.         return $this;
  201.     }
  202.     public function getUseScore(): ?bool
  203.     {
  204.         return $this->useScore;
  205.     }
  206.     public function setUseScore(bool $useScore): self
  207.     {
  208.         $this->useScore $useScore;
  209.         return $this;
  210.     }
  211.     public function getDepartment(): ?Department
  212.     {
  213.         return $this->department;
  214.     }
  215.     public function setDepartment(?Department $department): self
  216.     {
  217.         $this->department $department;
  218.         return $this;
  219.     }
  220.     public function getAppraisal(): ?Appraisal
  221.     {
  222.         return $this->appraisal;
  223.     }
  224.     public function setAppraisal(?Appraisal $appraisal): self
  225.     {
  226.         $this->appraisal $appraisal;
  227.         return $this;
  228.     }
  229.     public function getType(): ?string
  230.     {
  231.         return $this->type;
  232.     }
  233.     public function setType(?string $type): self
  234.     {
  235.         $this->type $type;
  236.         return $this;
  237.     }
  238.     public function getUpdatedBy(): ?User
  239.     {
  240.         return $this->updatedBy;
  241.     }
  242.     public function setUpdatedBy(?User $updatedBy): self
  243.     {
  244.         $this->updatedBy $updatedBy;
  245.         return $this;
  246.     }
  247.     public function getUpdatedAt(): ?\DateTimeImmutable
  248.     {
  249.         return $this->updatedAt;
  250.     }
  251.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  252.     {
  253.         $this->updatedAt $updatedAt;
  254.         return $this;
  255.     }
  256.     public function getAppraisalCategory(): ?AppraisalCategory
  257.     {
  258.         return $this->appraisalCategory;
  259.     }
  260.     public function setAppraisalCategory(?AppraisalCategory $appraisalCategory): self
  261.     {
  262.         $this->appraisalCategory $appraisalCategory;
  263.         return $this;
  264.     }
  265.     public function getCustomOrder(): ?int
  266.     {
  267.         return $this->customOrder;
  268.     }
  269.     public function setCustomOrder(int $customOrder): self
  270.     {
  271.         $this->customOrder $customOrder;
  272.         return $this;
  273.     }
  274. }