<?php
namespace App\Entity\System;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\System\ProfileRepository")
*
* @ORM\Table(name="ps_profile")
*/
class Profile
{
public const ROOT_ID = 1;
public const SUPPORT_ID = 12;
public const TECH_SUPPORT_ID = 25;
/** @var int
* @ORM\Id()
*
* @ORM\GeneratedValue()
*
* @ORM\Column(type="integer", name="id_profile")
*/
private $id;
/** @var string
* @ORM\Column(type="string", length=25)
*/
private $name;
/**
* @var Role[]|ArrayCollection
*
* @ORM\ManyToMany(targetEntity="App\Entity\System\Role", inversedBy="profiles")
*
* @ORM\JoinTable(name="ps_profile_role",
* joinColumns={@ORM\JoinColumn(name="id_profile", referencedColumnName="id_profile")},
* inverseJoinColumns={@ORM\JoinColumn(name="id_role", referencedColumnName="id_role")}
* )
*/
private $roles;
public function __construct()
{
$this->roles = new ArrayCollection();
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*
* @return Profile
*/
public function setId(int $id): Profile
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
*
* @return Profile
*/
public function setName(string $name): Profile
{
$this->name = $name;
return $this;
}
/**
* @return ArrayCollection|Role[]
*/
public function getRoles()
{
return $this->roles;
}
/**
* @param ArrayCollection|Role[] $roles
*
* @return Profile
*/
public function setRoles(ArrayCollection $roles): Profile
{
$this->roles = $roles;
return $this;
}
public function addRole(Role $role): self
{
if (!$this->roles->contains($role)) {
$this->roles[] = $role;
}
return $this;
}
public function removeRole(Role $role): self
{
if ($this->roles->contains($role)) {
$this->roles->removeElement($role);
}
return $this;
}
}