src/Entity/User/UserRights.php line 19
<?php
namespace App\Entity\User;
use App\Entity\Common\Owner;
use App\Entity\Traits\ActiveTrait;
use App\Entity\Traits\TrackerFields;
use App\Entity\Traits\UserCreatedInterface;
use App\Entity\Traits\UserUpdatedInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* Class UserRights
* @package App\Entity\User
*/
#[ORM\Table(name: 'user_rights')]
#[ORM\Entity(repositoryClass: 'App\Repository\User\UserRightsRepository')]
#[ORM\HasLifecycleCallbacks]
class UserRights implements UserCreatedInterface, UserUpdatedInterface
{
use ActiveTrait;
use TrackerFields;
public const OLYMPIAD_ADMIN = 'admin';
public const OLYMPIAD_JURY = 'jury';
public static function getOlympiadRoles(): array
{
return [
self::OLYMPIAD_ADMIN,
self::OLYMPIAD_JURY,
];
}
/**
* @var int|null
*/
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private int $id;
/**
* @var User
*
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\User\User')]
#[ORM\JoinColumn(nullable: false)]
private User $user;
/**
* @var Owner
*/
#[ORM\Embedded(class: 'App\Entity\Common\Owner')]
private Owner $owner;
/**
* @var string
*/
#[ORM\Column(type: 'string')]
private string $role;
/**
* @var array
*/
#[ORM\Column(type: 'json')]
private array $payload = [];
public function __construct()
{
$this->owner = new Owner();
}
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
/**
* @return User
*/
public function getUser(): User
{
return $this->user;
}
/**
* @param User $user
*/
public function setUser(User $user): void
{
$this->user = $user;
}
/**
* @return Owner
*/
public function getOwner(): Owner
{
return $this->owner;
}
/**
* @param Owner $owner
*/
public function setOwner(Owner $owner): void
{
$this->owner = $owner;
}
/**
* @return string
*/
public function getRole(): string
{
return $this->role;
}
/**
* @param string $role
*/
public function setRole(string $role): void
{
$this->role = $role;
}
/**
* @return array
*/
public function getPayload(): array
{
return $this->payload;
}
/**
* @param array $payload
*/
public function setPayload(array $payload): void
{
$this->payload = $payload;
}
}