<?php
/**
* @author Leo BANNHOLTZER (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace App\Entity;
use App\Entity\User;
use App\Entity\Context;
use Symfony\Component\Uid\Uuid;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\UserContextRepository;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
/**
* @ORM\Entity(repositoryClass=UserContextRepository::class)
*/
class UserContext
{
/**
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private ?Uuid $id = null;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="userContexts")
* @ORM\JoinColumn(nullable=false)
*/
private ?User $user;
/**
* @ORM\ManyToOne(targetEntity=Context::class, inversedBy="users")
* @ORM\JoinColumn(nullable=false)
*/
private Context $context;
/**
* @return Uuid|null
*/
public function getId(): ?Uuid
{
return $this->id;
}
/**
* @return User
*/
public function getUser(): User
{
return $this->user;
}
/**
* @param User $user
* @return $this
*/
public function setUser(User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Context
*/
public function getContext(): Context
{
return $this->context;
}
/**
* @param Context $context
* @return $this
*/
public function setContext(Context $context): self
{
$this->context = $context;
return $this;
}
}