src/ProfileBundle/Entity/UserTag.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\ProfileBundle\Entity;
  3. use App\CmsBundle\Entity\Tag;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\ProfileBundle\Repository\UserTagRepository")
  7.  * @ORM\Table(name="user_tag",
  8.  *     indexes={
  9.  *         @ORM\Index(name="user_idx", columns={"user_id"}),
  10.  *         @ORM\Index(name="user_tag_idx", columns={"tag_id"})
  11.  *     },
  12.  *     uniqueConstraints={
  13.  *         @ORM\UniqueConstraint(name="user_tag_unique", columns={"user_id", "tag_id"})
  14.  *     }
  15.  * )
  16.  */
  17. class UserTag
  18. {
  19.     /**
  20.      * @ORM\Id
  21.      * @ORM\ManyToOne(targetEntity=User::class)
  22.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  23.      */
  24.     private User $user;
  25.     /**
  26.      * @ORM\Id
  27.      * @ORM\ManyToOne(targetEntity=Tag::class, inversedBy="userTags")
  28.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  29.      */
  30.     private Tag $tag;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=UserTagAction::class)
  33.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  34.      */
  35.     private ?UserTagAction $userTagAction;
  36.     /**
  37.      * @ORM\Column(type="float")
  38.      */
  39.     private ?float $weight;
  40.     /**
  41.      * @return User
  42.      */
  43.     public function getUser(): User
  44.     {
  45.         return $this->user;
  46.     }
  47.     /**
  48.      * @param User $user
  49.      * @return $this
  50.      */
  51.     public function setUser(User $user): self
  52.     {
  53.         $this->user $user;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return Tag
  58.      */
  59.     public function getTag(): Tag
  60.     {
  61.         return $this->tag;
  62.     }
  63.     /**
  64.      * @param Tag $tag
  65.      * @return $this
  66.      */
  67.     public function setTag(Tag $tag): self
  68.     {
  69.         $this->tag $tag;
  70.         return $this;
  71.     }
  72.     /**
  73.      * @return UserTagAction|null
  74.      */
  75.     public function getUserTagAction(): ?UserTagAction
  76.     {
  77.         return $this->userTagAction;
  78.     }
  79.     /**
  80.      * @param UserTagAction|null $userTagAction
  81.      * @return $this
  82.      */
  83.     public function setUserTagAction(?UserTagAction $userTagAction): self
  84.     {
  85.         $this->userTagAction $userTagAction;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return float|null
  90.      */
  91.     public function getWeight(): ?float
  92.     {
  93.         return $this->weight;
  94.     }
  95.     /**
  96.      * @param float $weight
  97.      * @return $this
  98.      */
  99.     public function setWeight(float $weight): self
  100.     {
  101.         $this->weight $weight;
  102.         return $this;
  103.     }
  104. }