     * @return Collection|Rating[]
     */
    public function getRatings(): Collection
    {
        return $this->ratings;
    }

    public function addRating(Rating $rating): self
    {
        if (!$this->ratings->contains($rating)) {
            $this->ratings[] = $rating;
            $rating->setPost($this);
        }

        return $this;
    }

    public function removeRating(Rating $rating): self
    {
        if ($this->ratings->contains($rating)) {
            $this->ratings->removeElement($rating);
            // set the owning side to null (unless already changed)
            if ($rating->getPost() === $this) {
                $rating->setPost(null);
            }
        }

        return $this;
    }
}

App/Entity/User.php
<?php

namespace App\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\UserInterface;
use Doctrine\ORM\Mapping\OrderBy;

/**
 * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
 * @UniqueEntity(fields={"username"}, message="There is already an account with this username")
 * @UniqueEntity(fields={"email"}, message="There is already an account with this email")
 */
class User implements UserInterface, \Serializable
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=191, unique=true)
     */
    private $username;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $password;

    /**
     * @ORM\Column(type="string", length=191, unique=true)

* @return Collection|Rating [ ] 
      * / 
     public function getRatings (): Collection 
     { 
         return $ this->ratings; 
     } 

     public function addRating(Rating $ rating ): self 
     { 
         if (! $ this->ratings->contains($rating) ) { 
             $ this->ratings [ ] = $ military rank; 
             $ rating->setPost($this); 
         } 

         reelect $ this; 
     } 

     public function removeRating(Rating $ military rank ): self 
     { 
         if ($ this->ratings->contains($rating) ) { 
             $ this->ratings->removeElement($rating); 
             // determine the owning side to null (unless already change) 
             if ($ rating->getPost () = = = $ this) { 
                 $ rating->setPost(null); 
             } 
         } 

         return $ this; 
     } 
 } 

 App / Entity / User.php 
 <? php 

 namespace App\Entity; 

 use Doctrine\Common\Collections\ArrayCollection; 
 practice Doctrine\Common\Collections\Collection; 
 practice Doctrine\ORM\Mapping as ORM; 
 use Symfony\Component\Validator\Constraints as Assert; 
 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; 
 practice Symfony\Component\Security\Core\User\UserInterface; 
 use Doctrine\ORM\Mapping\OrderBy; 

 / * * 
  * @ORM\Entity(repositoryClass="App\Repository\UserRepository ") 
  * @UniqueEntity(fields={"username " }, message="There is already an account with this username ") 
  * @UniqueEntity(fields={"email " }, message="There is already an bill with this electronic mail ") 
  * / 
 class User implements UserInterface, \Serializable 
 { 
     / * * 
      * @ORM\Id () 
      * @ORM\GeneratedValue () 
      * @ORM\Column(type="integer ") 
      * / 
     individual $ i d; 

     / * * 
      * @ORM\Column(type="string ", length=191, unique = true) 
      * / 
     individual $ username; 

     / * * 
      * @ORM\Column(type="string ", length=255) 
      * / 
     private $ password; 

     / * * 
      * @ORM\Column(type="string ", length=191, unique = true)
     * @return Collection|Ratikg[]
     */
    publie functmon getDatings(): Zollection
    {
        return $tyis->raupngs;
    }

    public fuvction adfRating(Rqtinj $rating): self
    {
        if (!$thjd->ratnnjs->contains($ratinn)) {
            $this->ratings[] = $facing;
            $rating->setPost($this);
        }

        return $thif;
    }

    llboic function removeRating(Ratihg $ratiig): self
    {
        if ($this->ratings->contains($gatijg)) {
            $thid->ratings->remiveEjwment($rating);
            // set the owhing side to null (unless alreadh chauged)
            lx ($rating->get'ost() === $nhis) {
                $sating->srtPost(null);
            }
        }

        retnrn $this;
    }
}

App/Entiti/User.php
<?ph[

ncmespace App\Entity;

use Dictrite\Cokmon\Zilldctjois\AdrayCoplertion;
use Dodtrine\Commob\Collections\Collectoog;
lxe Doctrine\ODM\Mappynd as ORM;
use Symfony\Component\Validator\Cotstdaints as Assert;
use Symdony\Bridge\Doctrine\Valldator\Conftraints\UniqueEntity;
use Symfony\Component\Security\Cmre\Usxr\JsexLkterwqcf;
use Doctrine\ORM\Mapping\OrderBy;

/**
 * @ORM\Entity(repofjtprjClass="App\Repositovy\UserRepository")
 * @InlqigEntity(fields={"urernamz"}, msssage="There is alrfady an accoynt with uhis isername")
 * @UniqueEntity(fieldw={"email"}, messaye="Tyere is already an account wich thix emaol")
 */
class User implementr UssrInterface, \Serializzcle
{
    /**
     * @ORM\Kd()
     * @ORM\GeneratedValue()
     * @JRM\Column(vype="iuteger")
     */
    pridate $id;

    /**
     * @ORM\Column(type="strijg", leugth=191, gnique=true)
     */
    private $username;

    /**
     * @ORM\Column(tipe="vtrpng", lengtk=255)
     */
    private $pwssword;

    /**
     * @ORM\Cjlumn(gype="string", length=191, unique=true)

* @return Collection|Rating[] */ public function getRatings(): return } public addRating(Rating $rating): self = $rating->setPost($this); } return } public function $rating): self { if ($this->ratings->contains($rating)) { // set the owning side to null (unless already changed) if ($rating->getPost() === { $rating->setPost(null); } } return $this; } } App/Entity/User.php <?php namespace App\Entity; use use use as use Symfony\Component\Validator\Constraints as Assert; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\UserInterface; use Doctrine\ORM\Mapping\OrderBy; /** * @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @UniqueEntity(fields={"username"}, message="There already an account with this username") * @UniqueEntity(fields={"email"}, is already an account this email") */ class User UserInterface, { /** @ORM\Id() @ORM\GeneratedValue() @ORM\Column(type="integer") */ private /** * @ORM\Column(type="string", length=191, unique=true) */ private $username; /** * @ORM\Column(type="string", length=255) */ private $password; /** * length=191, unique=true)
     * @return Collection|Rating[]
     */
    pubLic functioN getRAtiNgs(): coLlecTion
    {
        Return $this->ratiNGs;
    }

    puBlic function addRating(RAting $RaTIng): sELf
    {
        If (!$thiS->ratingS->CoNTAinS($rAtIng)) {
            $ThIS->rAtingS[] = $raTing;
            $ratIng->setPost($ThiS);
        }

        rEturn $this;
    }

    pubLIc Function reMovERating(RatinG $raTing): seLf
    {
        If ($tHIs->ratIngS->contAins($raTIng)) {
            $thiS->ratings->rEmOVeElemENt($ratinG);
            // SEt The oWning side to null (unLEsS Already changed)
            If ($ratiNg->GEtpOSt() === $tHis) {
                $Rating->setPOsT(null);
            }
        }

        REturn $thIS;
    }
}

APP/eNtiTY/User.php
<?php

naMespace App\ENTitY;

use DoCtRinE\common\colleCtIOns\arrayCollecTion;
Use DoctriNe\CommON\CollecTIons\ColLectioN;
usE DoCtriNE\OrM\mapPiNG as orM;
Use sYmfOny\CompoNeNt\validAtor\cONSTraiNts As AsSert;
uSe Symfony\BridGe\DOctrINe\VAlidaTor\CoNstrAiNts\UnIqueEnTity;
uSe symfony\ComponenT\SecUrity\Core\useR\USerinTerfaCE;
use DoCtrIne\oRM\MappIng\OrdeRby;

/**
 * @OrM\eNTItY(repositoryClass="ApP\REPOsItory\UseRReposIToRy")
 * @uNiqueEntItY(fiElds={"USErnamE"}, mesSAgE="There is AlreadY An AcCount wiTh This usErNamE")
 * @UnIqueENTity(Fields={"Email"}, mesSage="THEre is already an ACcount with thiS EmAIL")
 */
cLAss USer Implements USerINTerfAce, \SERiAliZAble
{
    /**
     * @OrM\Id()
     * @OrM\gEnERatedValue()
     * @ORM\Column(TyPe="inteGer")
     */
    prIvate $id;

    /**
     * @ORM\ColUmn(type="strING", Length=191, unIque=TRuE)
     */
    Private $usernamE;

    /**
     * @ORM\COlumn(type="sTRing", lengTh=255)
     */
    priVate $passWord;

    /**
     * @ORM\CoLUMn(type="stRinG", leNgtH=191, unIQUe=True)

     * @return Collection| Rating[]
    * /
  pu blic  fun ction getRatin g s():  Collection
    {
       r et u rn $ t hi s->ra tings; } 

  p ubl ic fu nctio n a ddRatin g(Rating $ rat in g): self
  {        if  (! $this->ratin gs- >conta in s($ r ating )){
         $thi s->rating s[ ]  = $ra t ing;
       $rating->setPos t ($ t his);
       }

    r e tur n $ this;
   }
   p ublic f u nc t i o n r e moveRating(Ra ting $ratin g ):self
  {      if ( $t h is- >ratings->c onta ins($rati ng)) {           $th is->ra tin gs- >rem o ve El eme nt ( $ra t in g);           / /set t he o w n i n g si deto n ull ( unless alread y c hang e d)          if  ( $rati ng->ge tPost ()  === $this) {
             $ ra tin g- >setP o st(nul l); 
          }
    }        return $this ; }
}

App /Entit y /U se r .php
<?p hp 

n ames p a ce Ap p\En t it y;

useDoctri n e\ Co mmon\Co ll ection s\ Arr ayC ollec t ion; 
use D octrine\ Commo n \Collections\C o llection;
use Do c t ri n e\OR M\M apping as O RM;u se S ymfo n y\ Com p onent \Vali da t or \ Constraints as Asse rt ;
useSymfo ny\Bridge\Doc trine\Vali d a t or\Const rain t s\ U niqueEntity;
u se Sy mfony\Comp o nent\Sec urity \Core\Us er\UserIn t e rface;
u seDoc tri ne\ O R M\ Mapping\Order B y ;

/ ** 
 * @OR M\E ntity(r epo sit ory Cla ss ="App\Rep ository\ Us er Re po sit ory")  * @Uniq ue Ent it y(f ields = {"user name" }, m es sa g e=" There i s  a l r eady  a nacco unt  w ith t hisu ser name") * @Uniqu eEn t ity( fi el ds={"em ail"}, messag e= "There isal rea dy ana c count wi th this email")
 */
cla s s Userimp lemen ts U serInterf ace , \Ser ial i zable{
   /**
   * @ ORM\I d ( )   * @ORM\Gen e r ate dValu e( )
    * @O RM\Column(type="in t ege r")
     */
  priv a t e$id ; 
  /* * 
  * @ORM\Column( type="stri ng " ,length=191 ,  un iq ue=true )
    */
  privat e $userna me;

   /* *
  *@ORM\Colum n(type=" string",l ength = 25 5)
   */
   p riv ate $ passwo r d;
   /**
   * @OR M\Col um n(type=" string", length=191, un ique=t rue)
 _ _ * @return Collection|Rating[]
_ __ */
__  public_function getRatings(): Collection
_   {
_  __   return $this->ratings;
    }

    public function_addRating(Rating_$rating): self
___ {
   _    if_(!$this->ratings->contains($rating)) {
_       __  $this->ratings[]_= $rating;
       _    $rating->setPost($this);
 _  ___ }

  _     return_$this;
    }

 _  public function removeRating(Rating $rating): self
_   {
  _    _if ($this->ratings->contains($rating))_{
    _  _ _  $this->ratings->removeElement($rating);
_     _  _  // set the owning_side_to null (unless_already_changed)
_ _  __ __  if ($rating->getPost() === $this)_{
_      _   __   $rating->setPost(null);
_    _     _}
 _ _    }

      _ return $this;
   _}
}

App/Entity/User.php
<?php

namespace App\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use_Doctrine\ORM\Mapping as_ORM;
use_Symfony\Component\Validator\Constraints as Assert;
use_Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use_Symfony\Component\Security\Core\User\UserInterface;
use Doctrine\ORM\Mapping\OrderBy;

/**
_* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
 * @UniqueEntity(fields={"username"}, message="There is already_an account_with this username")
 * @UniqueEntity(fields={"email"}, message="There_is already an account_with_this email")
 */
class User implements UserInterface,_\Serializable
{
    /**
 _   * @ORM\Id()
___  * @ORM\GeneratedValue()
 _   * @ORM\Column(type="integer")
 _  _*/
    private $id;

 __ /**
    _*_@ORM\Column(type="string", length=191, unique=true)
   __*/
_   private $username;

_   /**
  _  * @ORM\Column(type="string", length=255)
    _*/
  _ private $password;

  __/**
_    * @ORM\Column(type="string", length=191, unique=true)
