<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\ProfileRepository")
* @ORM\Table(name="profiles", indexes={@ORM\Index(name="id_index", columns={"id"})})
*/
class Profile
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=50, nullable=false)
*/
private $name;
/**
* @ORM\Column(type="json", nullable=true)
*/
private $roles;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $is_global;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $status;
/**
* @ORM\OneToMany(targetEntity="App\Entity\UserProfile", mappedBy="profile")
*/
private $userProfiles;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="profiles")
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
*/
private $customer;
public function __construct()
{
$this->userProfiles = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getRoles(): ?array
{
return $this->roles;
}
public function setRoles(?array $roles): self
{
$this->roles = $roles;
return $this;
}
public function getIsGlobal(): ?bool
{
return $this->is_global;
}
public function setIsGlobal(bool $is_global): self
{
$this->is_global = $is_global;
return $this;
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, UserProfile>
*/
public function getUserProfiles(): Collection
{
return $this->userProfiles;
}
public function addUserProfile(UserProfile $userProfile): self
{
if (!$this->userProfiles->contains($userProfile)) {
$this->userProfiles[] = $userProfile;
$userProfile->setProfile($this);
}
return $this;
}
public function removeUserProfile(UserProfile $userProfile): self
{
if ($this->userProfiles->removeElement($userProfile)) {
// set the owning side to null (unless already changed)
if ($userProfile->getProfile() === $this) {
$userProfile->setProfile(null);
}
}
return $this;
}
public function getCustomer(): ?Customer
{
return $this->customer;
}
public function setCustomer(?Customer $customer): self
{
$this->customer = $customer;
return $this;
}
}