src/Entity/Profile.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use ApiPlatform\Core\Annotation\ApiSubresource;
  5. use App\Controller\Api\ProfileController;
  6. use App\Controller\Api\ProfileImageController;
  7. use App\Repository\ProfileRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\DBAL\Types\Types;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\Serializer\Annotation\Groups;
  13. use Symfony\Component\Serializer\Annotation\MaxDepth;
  14. use Symfony\Component\HttpFoundation\File\File;
  15. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. use App\Repository\AnswerRepository;
  18. use Doctrine\Common\Collections\Criteria;
  19. #[ORM\Entity(repositoryClassProfileRepository::class)]
  20. #[ApiResource(
  21.     normalizationContext: ['groups' => ['profile']],
  22.     denormalizationContext: ['groups' => ['profile']],
  23.     
  24.     )]
  25. class Profile
  26. {
  27.     #[ORM\Id]
  28.     #[ORM\GeneratedValue]
  29.     #[ORM\Column(type'integer')]
  30.    #[Groups("profile")]
  31.     private $id;
  32.     #[ORM\Column(type'string'length255nullabletrue)]
  33.     #[Groups(["profile","read_2"])]
  34.    
  35.     private $firstName;
  36.     #[ORM\Column(type'string'length255nullabletrue)]
  37.     #[Groups(["profile","read_2"])]
  38.     private $lastName;
  39.     #[ORM\Column(type'string'length255nullabletrue)]
  40.     #[Groups("profile")]
  41.     private $profileImage;
  42.     #[ORM\Column(type'string'length255nullabletrue)]
  43.     private $phoneNumber;
  44.     #[ORM\Column(type'string'nullabletrue)]
  45.     #[Groups("profile")]
  46.     private $gender;
  47.     #[ORM\OneToOne(inversedBy'profile'targetEntityUser::class, cascade: ['persist''remove'])]
  48.     #[Groups(["profile","read_2"])]
  49.     #[Assert\Valid]
  50.     private $user;
  51.     
  52.     #[ORM\ManyToMany(targetEntityLangue::class, inversedBy'profiles')]
  53.     #[Groups("read")]
  54.     private Collection $langues;
  55.     #[ORM\Column(length255nullabletrue)]
  56.     #[Groups("profile")]
  57.     private ?string $profession null;
  58.     #[ORM\Column(length255nullabletrue)]
  59.     #[Groups("profile")]
  60.     private ?string $bio null;
  61.     #[ORM\Column(length255nullabletrue)]
  62.     #[Groups("profile")]
  63.     private ?string $pseudoName null;
  64.     #[ORM\OneToMany(mappedBy'profile'targetEntityGallery::class)]
  65.     private Collection $galleries;
  66.     #[ORM\ManyToMany(targetEntityInterest::class, inversedBy'profiles')]
  67.     #[Groups("read")]
  68.     private Collection $interests;
  69.     #[ORM\Column(length255nullabletrue)]
  70.     #[Groups("profile")]
  71.     private ?string $address null;
  72.     #[ORM\OneToOne(inversedBy'profile'cascade: ['persist''remove'])]
  73.     #[Groups("profile")]
  74.     private ?ProfileTargetSetting $profileTargetSetting null;
  75.     #[ORM\Column(nullabletrue)]
  76.     #[Groups("profile")]
  77.     private ?bool $isVisible true;
  78.     #[ORM\Column(nullabletrue)]
  79.     #[Groups("profile")]
  80.     private ?bool $isDeleted null;
  81.     #[ORM\Column(length255nullabletrue)]
  82.     #[Groups("profile")]
  83.     private ?string $lng null;
  84.     #[ORM\Column(length255nullabletrue)]
  85.     #[Groups("profile")]
  86.     private ?string $lat null;
  87.     #[ORM\Column(length255nullabletrue)]
  88.     #[Groups("profile")]
  89.     private ?string $educationLevel null;
  90.     #[ORM\ManyToMany(targetEntityAnswer::class, inversedBy'profiles')]
  91.     #[Groups("profile")]
  92.     private Collection $answers;
  93.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  94.     #[Groups("profile")]
  95.     private ?\DateTimeInterface $bornAt null;
  96.     #[ORM\Column(nullabletrue)]
  97.     #[Groups("profile")]
  98.     private ?bool $isSmoker null;
  99.     #[ORM\Column(nullabletrue)]
  100.     #[Groups("profile")]
  101.     private ?bool $isDrinker null;
  102.     #[ORM\Column(nullabletrue)]
  103.     #[Groups("profile")]
  104.     private ?bool $hasKids null;
  105.     #[ORM\Column(nullabletrue)]
  106.     #[Groups("profile")]
  107.     private ?bool $isDevorced null;
  108.     #[ORM\OneToMany(mappedBy'profileAskForMatch'targetEntityMatchProfile::class)]
  109.     #[Groups("read")]
  110.     private Collection $askedMatches;
  111.     
  112.  #[Groups("read")]
  113.                                                                                                                                      #[ORM\OneToMany(mappedBy'profileMatched'targetEntityMatchProfile::class)]
  114.                                                                                                                                      
  115.                                                                                                                                      private Collection $matchesByOthers;
  116.     #[ORM\Column(nullabletrue)]
  117.     #[Groups("profile")]
  118.     private ?bool $isNewMatchesByEmail null;
  119.     #[ORM\Column(nullabletrue)]
  120.     #[Groups("profile")]
  121.     private ?bool $isNewMessagesByEmail null;
  122.     #[ORM\Column(nullabletrue)]
  123.     #[Groups("profile")]
  124.     private ?bool $isNewFeedsByEmail null;
  125.     #[ORM\Column(nullabletrue)]
  126.     #[Groups("profile")]
  127.     private ?bool $isNewMatchesByNotif null;
  128.     #[ORM\Column(nullabletrue)]
  129.     #[Groups("profile")]
  130.     private ?bool $isNewMessagesByNotif null;
  131.     #[ORM\Column(length255nullabletrue)]
  132.     #[Groups("profile")]
  133.     private ?string $imageGallery1 null;
  134.     #[ORM\Column(length255nullabletrue)]
  135.     #[Groups("profile")]
  136.     private ?string $imageGallery2 null;
  137.     #[ORM\Column(length255nullabletrue)]
  138.     #[Groups("profile")]
  139.     private ?string $imageGallery3 null;
  140.     #[ORM\Column(length255nullabletrue)]
  141.     #[Groups("profile")]
  142.     private ?string $imageGallery4 null;
  143.     #[ORM\Column(length255nullabletrue)]
  144.     #[Groups("profile")]
  145.     private ?string $imageGallery5 null;
  146.     #[ORM\ManyToMany(targetEntityself::class, inversedBy'likedBy')]
  147.     #[ORM\JoinTable(
  148.         name"profiles_likes"
  149.     )]
  150.     private Collection $likedProfiles;
  151.     #[ORM\ManyToMany(targetEntityself::class, mappedBy'likedProfiles')]
  152.     private Collection $likedBy;
  153.     
  154.     #[ORM\ManyToMany(targetEntityself::class, inversedBy'dislikedBy')]
  155.     #[ORM\JoinTable(
  156.         name"profiles_dislikes"
  157.     )]
  158.     private Collection $dislikedProfiles;
  159.     #[ORM\ManyToMany(targetEntityself::class, mappedBy'dislikedProfiles')]
  160.     private Collection $dislikedBy;
  161.     #[ORM\ManyToMany(targetEntityself::class, inversedBy'matchedByProfiles')]
  162.     private Collection $matchedProfiles;
  163.     #[ORM\ManyToMany(targetEntityself::class, mappedBy'matchedProfiles')]
  164.     private Collection $matchedByProfiles;
  165.     
  166.     public function __construct()
  167.     {
  168.     
  169.       
  170.         $this->langues = new ArrayCollection();
  171.         // $this->matchs = new ArrayCollection();
  172.         // $this->boosts = new ArrayCollection();
  173.         $this->galleries = new ArrayCollection();
  174.         $this->interests = new ArrayCollection();
  175.         $this->user = new User();
  176.         $this->answers = new ArrayCollection();
  177.         $this->askedMatches = new ArrayCollection();
  178.         $this->matchesByOthers = new ArrayCollection();
  179.         $this->setProfileTargetSetting(new ProfileTargetSetting());
  180.         $this->likedProfiles = new ArrayCollection();
  181.         $this->likedBy = new ArrayCollection();
  182.         $this->dislikedProfiles = new ArrayCollection();
  183.         $this->dislikedBy = new ArrayCollection();
  184.         $this->matchedProfiles = new ArrayCollection();
  185.         $this->matchedByProfiles = new ArrayCollection();
  186.     }
  187.     
  188.     public function __toString()
  189.     {
  190.         if(!$this->firstName && !$this->lastName){
  191.             return (string)$this->getUser()->getEmail();
  192.         }
  193.         return (string)$this->firstName ." : ".(string)$this->getUser()->getEmail();
  194.     }
  195.     public function getId(): ?int
  196.     {
  197.         return $this->id;
  198.     }
  199.     public function getFirstName(): ?string
  200.     {
  201.         return $this->firstName;
  202.     }
  203.     public function setFirstName(?string $firstName): self
  204.     {
  205.         $this->firstName $firstName;
  206.         return $this;
  207.     }
  208.     public function getLastName(): ?string
  209.     {
  210.         return $this->lastName;
  211.     }
  212.     public function setLastName(?string $lastName): self
  213.     {
  214.         $this->lastName $lastName;
  215.         return $this;
  216.     }
  217.     public function getProfileImage(): ?string
  218.     {
  219.         return $this->profileImage;
  220.     }
  221.     public function setProfileImage(?string $profileImage): self
  222.     {
  223.         $this->profileImage $profileImage;
  224.         return $this;
  225.     }
  226.     public function getPhoneNumber(): ?string
  227.     {
  228.         return $this->phoneNumber;
  229.     }
  230.     public function setPhoneNumber(?string $phoneNumber): self
  231.     {
  232.         $this->phoneNumber $phoneNumber;
  233.         return $this;
  234.     }
  235.     public function getGender(): ?string
  236.     {
  237.         return $this->gender;
  238.     }
  239.     public function setGender(?string $gender): self
  240.     {
  241.         $this->gender $gender;
  242.         return $this;
  243.     }
  244.     public function getUser(): ?User
  245.     {
  246.         return $this->user;
  247.     }
  248.     public function setUser(?User $user): self
  249.     {
  250.         // unset the owning side of the relation if necessary
  251.         if ($user === null && $this->user !== null) {
  252.             $this->user->setProfile(null);
  253.         }
  254.         // set the owning side of the relation if necessary
  255.         if ($user !== null && $user->getProfile() !== $this) {
  256.             $user->setProfile($this);
  257.         }
  258.         $this->user $user;
  259.         return $this;
  260.     }
  261.     /**
  262.      * @return Collection<int, Langue>
  263.      */
  264.     public function getLangues(): Collection
  265.     {
  266.         return $this->langues;
  267.     }
  268.     public function addLangue(Langue $langue): self
  269.     {
  270.         if (!$this->langues->contains($langue)) {
  271.             $this->langues->add($langue);
  272.         }
  273.         return $this;
  274.        
  275.     }
  276.     public function removeLangue(Langue $langue): self
  277.     {
  278.         $this->langues->removeElement($langue);
  279.         return $this;
  280.     }
  281.     public function getProfession(): ?string
  282.     {
  283.         return $this->profession;
  284.     }
  285.     public function setProfession(?string $profession): self
  286.     {
  287.         $this->profession $profession;
  288.         return $this;
  289.     }
  290.     public function getBio(): ?string
  291.     {
  292.         return $this->bio;
  293.     }
  294.     public function setBio(?string $bio): self
  295.     {
  296.         $this->bio $bio;
  297.         return $this;
  298.     }
  299.     public function getPseudoName(): ?string
  300.     {
  301.         return $this->pseudoName;
  302.     }
  303.     public function setPseudoName(?string $pseudoName): self
  304.     {
  305.         $this->pseudoName $pseudoName;
  306.         return $this;
  307.     }
  308.     /**
  309.      * @return Collection<int, Gallery>
  310.      */
  311.     public function getGalleries(): Collection
  312.     {
  313.         return $this->galleries;
  314.     }
  315.     public function addGallery(Gallery $gallery): self
  316.     {
  317.         if (!$this->galleries->contains($gallery)) {
  318.             $this->galleries->add($gallery);
  319.             $gallery->setProfile($this);
  320.         }
  321.         return $this;
  322.     }
  323.     public function removeGallery(Gallery $gallery): self
  324.     {
  325.         if ($this->galleries->removeElement($gallery)) {
  326.             // set the owning side to null (unless already changed)
  327.             if ($gallery->getProfile() === $this) {
  328.                 $gallery->setProfile(null);
  329.             }
  330.         }
  331.         return $this;
  332.     }
  333.     /**
  334.      * @return Collection<int, Interest>
  335.      */
  336.     public function getInterests(): Collection
  337.     {
  338.         return $this->interests;
  339.     }
  340.     public function addInterest(Interest $interest): self
  341.     {
  342.         if (!$this->interests->contains($interest)) {
  343.             $this->interests->add($interest);
  344.         }
  345.         return $this;
  346.     }
  347.     public function removeInterest(Interest $interest): self
  348.     {
  349.         $this->interests->removeElement($interest);
  350.         return $this;
  351.     }
  352.     public function getAddress(): ?string
  353.     {
  354.         return $this->address;
  355.     }
  356.     public function setAddress(string $address): self
  357.     {
  358.         $this->address $address;
  359.         return $this;
  360.     }
  361.     public function getProfileTargetSetting(): ?ProfileTargetSetting
  362.     {
  363.         return $this->profileTargetSetting;
  364.     }
  365.     public function setProfileTargetSetting(?ProfileTargetSetting $profileTargetSetting): self
  366.     {
  367.         // unset the owning side of the relation if necessary
  368.         if ($profileTargetSetting === null && $this->profileTargetSetting !== null) {
  369.             $this->profileTargetSetting->setProfile(null);
  370.         }
  371.         // set the owning side of the relation if necessary
  372.         if ($profileTargetSetting !== null && $profileTargetSetting->getProfile() !== $this) {
  373.             $profileTargetSetting->setProfile($this);
  374.         }
  375.         $this->profileTargetSetting $profileTargetSetting;
  376.         return $this;
  377.     }
  378.     public function isIsVisible(): ?bool
  379.     {
  380.         return $this->isVisible;
  381.     }
  382.     public function setIsVisible(?bool $isVisible): self
  383.     {
  384.         $this->isVisible $isVisible;
  385.         return $this;
  386.     }
  387.     public function isIsDeleted(): ?bool
  388.     {
  389.         return $this->isDeleted;
  390.     }
  391.     public function setIsDeleted(?bool $isDeleted): self
  392.     {
  393.         $this->isDeleted $isDeleted;
  394.         return $this;
  395.     }
  396.     public function getLng(): ?string
  397.     {
  398.         return $this->lng;
  399.     }
  400.     public function setLng(?string $lng): self
  401.     {
  402.         $this->lng $lng;
  403.         return $this;
  404.     }
  405.     public function getLat(): ?string
  406.     {
  407.         return $this->lat;
  408.     }
  409.     public function setLat(?string $lat): self
  410.     {
  411.         $this->lat $lat;
  412.         return $this;
  413.     }
  414.     public function getEducationLevel(): ?string
  415.     {
  416.         return $this->educationLevel;
  417.     }
  418.     public function setEducationLevel(?string $educationLevel): self
  419.     {
  420.         $this->educationLevel $educationLevel;
  421.         return $this;
  422.     }
  423.     /**
  424.      * @return Collection<int, Answer>
  425.      */
  426.     public function getAnswers($type=null): Collection
  427.     {
  428.         
  429.         return $this->answers;
  430.     }
  431.     
  432.     public function getAnswersByType($conditionValue)
  433.     {
  434.         
  435.         $filtredAnswers = [];
  436.         
  437.         foreach($this->answers as $singleAnswer){
  438.             if($singleAnswer->getQuestion()->getType() == $conditionValue){
  439.                 $filtredAnswers[] = $singleAnswer;
  440.             }
  441.         }
  442.         return $filtredAnswers;
  443.         
  444.     }
  445.     public function addAnswer(Answer $answer): self
  446.     {
  447.         if (!$this->answers->contains($answer)) {
  448.             $this->answers->add($answer);
  449.         }
  450.         return $this;
  451.     }
  452.     public function removeAnswer(Answer $answer): self
  453.     {
  454.         $this->answers->removeElement($answer);
  455.         return $this;
  456.     }
  457.     public function getBornAt(): ?\DateTimeInterface
  458.     {
  459.         return $this->bornAt;
  460.     }
  461.     public function setBornAt(?\DateTimeInterface $bornAt): self
  462.     {
  463.         $this->bornAt $bornAt;
  464.         return $this;
  465.     }
  466.     #[Groups("profile")]
  467.     public function getAge()
  468.     {
  469.         $bornAt $this->getBornAt();
  470.         if($this->getBornAt()){
  471.             $dateOfBirth $bornAt->format("Y-m-d");
  472.             $today date("Y-m-d");
  473.             $diff date_diff(date_create($today),date_create($dateOfBirth));
  474.             return (int)$diff->format('%y');
  475.         }
  476.         
  477.         return 0;
  478.         
  479.     }
  480.     public function isIsSmoker(): ?bool
  481.     {
  482.         return $this->isSmoker;
  483.     }
  484.     public function setIsSmoker(?bool $isSmoker): self
  485.     {
  486.         $this->isSmoker $isSmoker;
  487.         return $this;
  488.     }
  489.     public function isIsDrinker(): ?bool
  490.     {
  491.         return $this->isDrinker;
  492.     }
  493.     public function setIsDrinker(?bool $isDrinker): self
  494.     {
  495.         $this->isDrinker $isDrinker;
  496.         return $this;
  497.     }
  498.     public function isHasKids(): ?bool
  499.     {
  500.         return $this->hasKids;
  501.     }
  502.     public function setHasKids(?bool $hasKids): self
  503.     {
  504.         $this->hasKids $hasKids;
  505.         return $this;
  506.     }
  507.     public function isIsDevorced(): ?bool
  508.     {
  509.         return $this->isDevorced;
  510.     }
  511.     public function setIsDevorced(?bool $isDevorced): self
  512.     {
  513.         $this->isDevorced $isDevorced;
  514.         return $this;
  515.     }
  516.     /**
  517.      * @return Collection<int, MatchProfile>
  518.      */
  519.     public function getAskedMatches(): Collection
  520.     {
  521.         return $this->askedMatches;
  522.     }
  523.     public function addAskedMatch(MatchProfile $askedMatch): self
  524.     {
  525.         if (!$this->askedMatches->contains($askedMatch)) {
  526.             $this->askedMatches->add($askedMatch);
  527.             $askedMatch->setProfileAskForMatch($this);
  528.         }
  529.         return $this;
  530.     }
  531.     public function removeAskedMatch(MatchProfile $askedMatch): self
  532.     {
  533.         if ($this->askedMatches->removeElement($askedMatch)) {
  534.             // set the owning side to null (unless already changed)
  535.             if ($askedMatch->getProfileAskForMatch() === $this) {
  536.                 $askedMatch->setProfileAskForMatch(null);
  537.             }
  538.         }
  539.         return $this;
  540.     }
  541.     /**
  542.      * @return Collection<int, MatchProfile>
  543.      */
  544.     public function getMatchesByOthers(): Collection
  545.     {
  546.         return $this->matchesByOthers;
  547.     }
  548.     public function addMatchesByOther(MatchProfile $matchesByOther): self
  549.     {
  550.         if (!$this->matchesByOthers->contains($matchesByOther)) {
  551.             $this->matchesByOthers->add($matchesByOther);
  552.             $matchesByOther->setProfileMatched($this);
  553.         }
  554.         return $this;
  555.     }
  556.     public function removeMatchesByOther(MatchProfile $matchesByOther): self
  557.     {
  558.         if ($this->matchesByOthers->removeElement($matchesByOther)) {
  559.             // set the owning side to null (unless already changed)
  560.             if ($matchesByOther->getProfileMatched() === $this) {
  561.                 $matchesByOther->setProfileMatched(null);
  562.             }
  563.         }
  564.         return $this;
  565.     }
  566.     public function isIsNewMatchesByEmail(): ?bool
  567.     {
  568.         return $this->isNewMatchesByEmail;
  569.     }
  570.     public function setIsNewMatchesByEmail(?bool $isNewMatchesByEmail): self
  571.     {
  572.         $this->isNewMatchesByEmail $isNewMatchesByEmail;
  573.         return $this;
  574.     }
  575.     public function isIsNewMessagesByEmail(): ?bool
  576.     {
  577.         return $this->isNewMessagesByEmail;
  578.     }
  579.     public function setIsNewMessagesByEmail(?bool $isNewMessagesByEmail): self
  580.     {
  581.         $this->isNewMessagesByEmail $isNewMessagesByEmail;
  582.         return $this;
  583.     }
  584.     public function isIsNewFeedsByEmail(): ?bool
  585.     {
  586.         return $this->isNewFeedsByEmail;
  587.     }
  588.     public function setIsNewFeedsByEmail(?bool $isNewFeedsByEmail): self
  589.     {
  590.         $this->isNewFeedsByEmail $isNewFeedsByEmail;
  591.         return $this;
  592.     }
  593.     public function isIsNewMatchesByNotif(): ?bool
  594.     {
  595.         return $this->isNewMatchesByNotif;
  596.     }
  597.     public function setIsNewMatchesByNotif(?bool $isNewMatchesByNotif): self
  598.     {
  599.         $this->isNewMatchesByNotif $isNewMatchesByNotif;
  600.         return $this;
  601.     }
  602.     public function isIsNewMessagesByNotif(): ?bool
  603.     {
  604.         return $this->isNewMessagesByNotif;
  605.     }
  606.     public function setIsNewMessagesByNotif(?bool $isNewMessagesByNotif): self
  607.     {
  608.         $this->isNewMessagesByNotif $isNewMessagesByNotif;
  609.         return $this;
  610.     }
  611.     public function getImageGallery1(): ?string
  612.     {
  613.         return $this->imageGallery1;
  614.     }
  615.     public function setImageGallery1(?string $imageGallery1): self
  616.     {
  617.         $this->imageGallery1 $imageGallery1;
  618.         return $this;
  619.     }
  620.     public function getImageGallery2(): ?string
  621.     {
  622.         return $this->imageGallery2;
  623.     }
  624.     public function setImageGallery2(?string $imageGallery2): self
  625.     {
  626.         $this->imageGallery2 $imageGallery2;
  627.         return $this;
  628.     }
  629.     public function getImageGallery3(): ?string
  630.     {
  631.         return $this->imageGallery3;
  632.     }
  633.     public function setImageGallery3(?string $imageGallery3): self
  634.     {
  635.         $this->imageGallery3 $imageGallery3;
  636.         return $this;
  637.     }
  638.     public function getImageGallery4(): ?string
  639.     {
  640.         return $this->imageGallery4;
  641.     }
  642.     public function setImageGallery4(?string $imageGallery4): self
  643.     {
  644.         $this->imageGallery4 $imageGallery4;
  645.         return $this;
  646.     }
  647.     public function getImageGallery5(): ?string
  648.     {
  649.         return $this->imageGallery5;
  650.     }
  651.     public function setImageGallery5(?string $imageGallery5): self
  652.     {
  653.         $this->imageGallery5 $imageGallery5;
  654.         return $this;
  655.     }
  656. #[Groups("profile")]
  657.     public function getCompletionProfilePercentage(){
  658.         
  659.         $percentage 0;
  660.         
  661.         $value 9.09
  662.         if($this->pseudoName){
  663.             $percentage $percentage +   $value;
  664.         }
  665.         if($this->gender){
  666.             $percentage $percentage +   $value;
  667.         }
  668.         if($this->profileImage){
  669.             $percentage $percentage +   $value;
  670.         }
  671.         if($this->profession){
  672.             $percentage $percentage +   $value;
  673.         }
  674.         if($this->educationLevel){
  675.             $percentage $percentage +   $value;
  676.         }
  677.         if($this->bio){
  678.             $percentage $percentage +   $value;
  679.         }
  680.         if($this->address){
  681.             $percentage $percentage +   $value;
  682.         }
  683.         
  684.         if($this->lng and $this->lat){
  685.             $percentage $percentage +   $value;
  686.         }
  687.         
  688.         if($this->bornAt){
  689.             $percentage $percentage +   $value;
  690.         }
  691.         
  692.         if(count($this->langues) > 0){
  693.             $percentage $percentage +   $value;
  694.         }
  695.         if(count($this->interests) > 0){
  696.             $percentage $percentage +   $value;
  697.         }
  698.         
  699.         return round($percentage0PHP_ROUND_HALF_UP);
  700.     }
  701.  
  702. public function getLikedProfiles()
  703. {
  704.     $filtredData = [];
  705.     
  706.     //return $filtredData;
  707.     foreach($this->likedProfiles as $singleProfile){
  708.         if(
  709.             !in_array($singleProfile,$this->getMatchedProfiles()) and 
  710.             !in_array($singleProfile,$this->getMatchedByProfiles()) and 
  711.             $singleProfile->isIsVisible()
  712.         ){
  713.             $filtredData[]=$singleProfile;
  714.         }
  715.         
  716.     }
  717.     return $filtredData;
  718. }
  719. public function addLikedProfile(self $likedProfile): self
  720. {
  721.     if (!$this->likedProfiles->contains($likedProfile)) {
  722.         $this->likedProfiles->add($likedProfile);
  723.     }
  724.     return $this;
  725. }
  726. public function removeLikedProfile(self $likedProfile): self
  727. {
  728.     $this->likedProfiles->removeElement($likedProfile);
  729.     return $this;
  730. }
  731. public function getLikedBy()
  732. {
  733.     $filtredData = [];
  734.     
  735.     //return $filtredData;
  736.     foreach($this->likedBy as $singleProfile){
  737.         if(
  738.             !in_array($singleProfile,$this->getMatchedProfiles()) and 
  739.             !in_array($singleProfile,$this->getMatchedByProfiles()) and 
  740.             $singleProfile->isIsVisible()
  741.         ){
  742.             $filtredData[]=$singleProfile;
  743.         }
  744.         
  745.     }
  746.     return $filtredData;
  747.     //return $this->likedBy;
  748. }
  749. public function addLikedBy(self $likedBy): self
  750. {
  751.     if (!$this->likedBy->contains($likedBy)) {
  752.         $this->likedBy->add($likedBy);
  753.         $likedBy->addLikedProfile($this);
  754.     }
  755.     return $this;
  756. }
  757. public function removeLikedBy(self $likedBy): self
  758. {
  759.     if ($this->likedBy->removeElement($likedBy)) {
  760.         $likedBy->removeLikedProfile($this);
  761.     }
  762.     return $this;
  763. }
  764. public function getDislikedProfiles()
  765. {
  766.     $filtredData = [];
  767.     
  768.     //return $filtredData;
  769.     foreach($this->dislikedProfiles as $singleProfile){
  770.         if(
  771.             !in_array($singleProfile,$this->getMatchedProfiles()) and 
  772.             !in_array($singleProfile,$this->getMatchedByProfiles()) and 
  773.             $singleProfile->isIsVisible()
  774.         ){
  775.             $filtredData[]=$singleProfile;
  776.         }
  777.         
  778.     }
  779.     return $filtredData;
  780.     //return $this->dislikedProfiles;
  781. }
  782. public function addDislikedProfile(self $dislikedProfile): self
  783. {
  784.     if (!$this->dislikedProfiles->contains($dislikedProfile)) {
  785.         $this->dislikedProfiles->add($dislikedProfile);
  786.     }
  787.     return $this;
  788. }
  789. public function removeDislikedProfile(self $dislikedProfile): self
  790. {
  791.     $this->dislikedProfiles->removeElement($dislikedProfile);
  792.     return $this;
  793. }
  794. public function getDislikedBy()
  795. {
  796.     $filtredData = [];
  797.     //return $filtredData;
  798.     foreach($this->dislikedBy as $singleProfile){
  799.         if(
  800.             !in_array($singleProfile,$this->getMatchedProfiles()) and 
  801.             !in_array($singleProfile,$this->getMatchedByProfiles()) and 
  802.             $singleProfile->isIsVisible()
  803.         ){
  804.             $filtredData[]=$singleProfile;
  805.         }
  806.         
  807.     }
  808.     return $filtredData;
  809.     //return $this->dislikedBy;
  810. }
  811. public function addDislikedBy(self $dislikedBy): self
  812. {
  813.     if (!$this->dislikedBy->contains($dislikedBy)) {
  814.         $this->dislikedBy->add($dislikedBy);
  815.         $dislikedBy->addDislikedProfile($this);
  816.     }
  817.     return $this;
  818. }
  819. public function removeDislikedBy(self $dislikedBy): self
  820. {
  821.     if ($this->dislikedBy->removeElement($dislikedBy)) {
  822.         $dislikedBy->removeDislikedProfile($this);
  823.     }
  824.     return $this;
  825. }
  826. public function getMatchedProfiles()
  827. {
  828.     return $this->matchedProfiles->toArray();
  829. }
  830. public function addMatchedProfile(self $matchedProfile): self
  831. {
  832.     if (!$this->matchedProfiles->contains($matchedProfile)) {
  833.         $this->matchedProfiles->add($matchedProfile);
  834.     }
  835.     return $this;
  836. }
  837. public function removeMatchedProfile(self $matchedProfile): self
  838. {
  839.     $this->matchedProfiles->removeElement($matchedProfile);
  840.     return $this;
  841. }
  842. public function getMatchedByProfiles()
  843. {
  844.     
  845.     return $this->matchedByProfiles->toArray();
  846. }
  847. public function addMatchedByProfile(self $matchedByProfile): self
  848. {
  849.     if (!$this->matchedByProfiles->contains($matchedByProfile)) {
  850.         $this->matchedByProfiles->add($matchedByProfile);
  851.         $matchedByProfile->addMatchedProfile($this);
  852.     }
  853.     return $this;
  854. }
  855. public function removeMatchedByProfile(self $matchedByProfile): self
  856. {
  857.     if ($this->matchedByProfiles->removeElement($matchedByProfile)) {
  858.         $matchedByProfile->removeMatchedProfile($this);
  859.     }
  860.     return $this;
  861. }
  862.     
  863.     
  864.    
  865. }