src/Entity/Profile.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\ProfileRepository")
  8.  * @ORM\Table(name="profiles", indexes={@ORM\Index(name="id_index", columns={"id"})})
  9.  */
  10. class Profile
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\Column(type="integer")
  15.      * @ORM\GeneratedValue(strategy="AUTO")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=50, nullable=false)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="json", nullable=true)
  24.      */
  25.     private $roles;
  26.     /**
  27.      * @ORM\Column(type="boolean", nullable=false)
  28.      */
  29.     private $is_global;
  30.     /**
  31.      * @ORM\Column(type="boolean", nullable=false)
  32.      */
  33.     private $status;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity="App\Entity\UserProfile", mappedBy="profile")
  36.      */
  37.     private $userProfiles;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="profiles")
  40.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  41.      */
  42.     private $customer;
  43.     public function __construct()
  44.     {
  45.         $this->userProfiles = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getName(): ?string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function setName(string $name): self
  56.     {
  57.         $this->name $name;
  58.         return $this;
  59.     }
  60.     public function getRoles(): ?array
  61.     {
  62.         return $this->roles;
  63.     }
  64.     public function setRoles(?array $roles): self
  65.     {
  66.         $this->roles $roles;
  67.         return $this;
  68.     }
  69.     public function getIsGlobal(): ?bool
  70.     {
  71.         return $this->is_global;
  72.     }
  73.     public function setIsGlobal(bool $is_global): self
  74.     {
  75.         $this->is_global $is_global;
  76.         return $this;
  77.     }
  78.     public function getStatus(): ?bool
  79.     {
  80.         return $this->status;
  81.     }
  82.     public function setStatus(bool $status): self
  83.     {
  84.         $this->status $status;
  85.         return $this;
  86.     }
  87.     /**
  88.      * @return Collection<int, UserProfile>
  89.      */
  90.     public function getUserProfiles(): Collection
  91.     {
  92.         return $this->userProfiles;
  93.     }
  94.     public function addUserProfile(UserProfile $userProfile): self
  95.     {
  96.         if (!$this->userProfiles->contains($userProfile)) {
  97.             $this->userProfiles[] = $userProfile;
  98.             $userProfile->setProfile($this);
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeUserProfile(UserProfile $userProfile): self
  103.     {
  104.         if ($this->userProfiles->removeElement($userProfile)) {
  105.             // set the owning side to null (unless already changed)
  106.             if ($userProfile->getProfile() === $this) {
  107.                 $userProfile->setProfile(null);
  108.             }
  109.         }
  110.         return $this;
  111.     }
  112.     public function getCustomer(): ?Customer
  113.     {
  114.         return $this->customer;
  115.     }
  116.     public function setCustomer(?Customer $customer): self
  117.     {
  118.         $this->customer $customer;
  119.         return $this;
  120.     }
  121. }