<?php
namespace App\Entity;
use App\Repository\UserRelationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=UserRelationRepository::class)
* @ORM\Table(name="affboss_affjuniors", uniqueConstraints={@ORM\UniqueConstraint(name="unique_boss_junior", columns={"user_source", "user_target", "relation_type", "product_id"})})
*/
class UserRelation
{
/**
* Oznaceni vztahu pro vyplaceni odmen
*/
const TYPE_REWARD = 'reward';
/**
* Oznaceni strukrualniho typu vztahu
*/
const TYPE_STRUCTURE = 'structure';
/**
* Oznaceni strukrualniho typu vztahu
*/
const TYPE_REWARD_DIRECT = 'reward_direct';
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="bosses")
* @ORM\JoinColumn(name="user_target", referencedColumnName="id", nullable=false)
*/
private $boss;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="juniors")
* @ORM\JoinColumn(name="user_source", referencedColumnName="id", nullable=true)
*/
private $junior;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $reward;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $relationType;
/**
* @ORM\ManyToOne(targetEntity=Product::class)
*/
private $product;
public function getId(): ?int
{
return $this->id;
}
public function getBoss(): ?User
{
return $this->boss;
}
public function setBoss(?User $boss): self
{
$this->boss = $boss;
return $this;
}
public function getJunior(): ?User
{
return $this->junior;
}
public function setJunior(?User $junior): self
{
$this->junior = $junior;
return $this;
}
public function getReward(): ?float
{
return $this->reward;
}
public function setReward(?float $reward): self
{
$this->reward = $reward;
return $this;
}
public function getRelationType(): ?string
{
return $this->relationType;
}
public function setRelationType(?string $relationType): self
{
$this->relationType = $relationType;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
}