src/Entity/UserRelation.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRelationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=UserRelationRepository::class)
  9.  * @ORM\Table(name="affboss_affjuniors", uniqueConstraints={@ORM\UniqueConstraint(name="unique_boss_junior", columns={"user_source", "user_target", "relation_type", "product_id"})})
  10.  */
  11. class UserRelation
  12. {
  13.     /**
  14.      * Oznaceni vztahu pro vyplaceni odmen
  15.      */
  16.     const TYPE_REWARD 'reward';
  17.     /**
  18.      * Oznaceni strukrualniho typu vztahu
  19.      */
  20.     const TYPE_STRUCTURE 'structure';
  21.     /**
  22.      * Oznaceni strukrualniho typu vztahu
  23.      */
  24.     const TYPE_REWARD_DIRECT 'reward_direct';
  25.     /**
  26.      * @ORM\Id
  27.      * @ORM\GeneratedValue
  28.      * @ORM\Column(type="integer")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="bosses")
  33.      * @ORM\JoinColumn(name="user_target", referencedColumnName="id", nullable=false)
  34.      */
  35.     private $boss;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="juniors")
  38.      * @ORM\JoinColumn(name="user_source", referencedColumnName="id", nullable=true)
  39.      */
  40.     private $junior;
  41.     /**
  42.      * @ORM\Column(type="float", nullable=true)
  43.      */
  44.     private $reward;
  45.     /**
  46.      * @ORM\Column(type="string", length=64, nullable=true)
  47.      */
  48.     private $relationType;
  49.     /**
  50.      * @ORM\ManyToOne(targetEntity=Product::class)
  51.      */
  52.     private $product;
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getBoss(): ?User
  58.     {
  59.         return $this->boss;
  60.     }
  61.     public function setBoss(?User $boss): self
  62.     {
  63.         $this->boss $boss;
  64.         return $this;
  65.     }
  66.     public function getJunior(): ?User
  67.     {
  68.         return $this->junior;
  69.     }
  70.     public function setJunior(?User $junior): self
  71.     {
  72.         $this->junior $junior;
  73.         return $this;
  74.     }
  75.     public function getReward(): ?float
  76.     {
  77.         return $this->reward;
  78.     }
  79.     public function setReward(?float $reward): self
  80.     {
  81.         $this->reward $reward;
  82.         return $this;
  83.     }
  84.     public function getRelationType(): ?string
  85.     {
  86.         return $this->relationType;
  87.     }
  88.     public function setRelationType(?string $relationType): self
  89.     {
  90.         $this->relationType $relationType;
  91.         return $this;
  92.     }
  93.     public function getProduct(): ?Product
  94.     {
  95.         return $this->product;
  96.     }
  97.     public function setProduct(?Product $product): self
  98.     {
  99.         $this->product $product;
  100.         return $this;
  101.     }
  102. }