<?php
namespace App\Entity;
use App\Repository\AccessModuleSectionsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=AccessModuleSectionsRepository::class)
* @ORM\Table(name="access_module_sections", options={"comment"="This table stores the user right modules sections, extended AccessModules"})
*
* @UniqueEntity(
* fields={"section_key", "access_module"},
* message="Module section already registered | Module section with combination (%s %s) is already registered"
* )
* */
class AccessModuleSections
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "right.module.section.core",
* "user_right_module_section@open_api",
*
* "access_module_section@core"
* })
*/
private $id;
/**
* @ORM\Column(type="string", length=64)
* @Groups({
* "right.module.section.core",
* "user_right_module_section@open_api",
*
* "access_module_section@core"
* })
*/
private $section_key;
/**
* @ORM\Column(type="string", length=64)
* @Groups({
* "right.module.section.core",
* "user_right_module_section@open_api",
*
* "access_module_section@core"
* })
*/
private $section_display_name;
/**
* @ORM\Column(type="json", nullable=true)
* @Groups({
* "right.module.section.core",
*
* "access_module_section@core"
* })
*/
private $manageable_actions = [];
/**
* @ORM\ManyToOne(targetEntity=AccessModules::class, inversedBy="access_module_sections")
* @Groups({
* "access_module_section@access_module"
* })
* @ORM\JoinColumn(onDelete="CASCADE")
*/
private $access_module;
/**
* Bunu Kullanma -> User Rights Kullan
* @ORM\OneToMany(targetEntity=UserModuleSectionPermissions::class, mappedBy="user_module_section")
* @Groups({
* "user_right_module_section@section_rights"
* })
*/
private $user_module_section_permissions;
public function __construct()
{
$this->user_module_section_permissions = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getSectionKey(): ?string
{
return $this->section_key;
}
public function setSectionKey(string $section_key): self
{
$this->section_key = $section_key;
return $this;
}
public function getSectionDisplayName(): ?string
{
return $this->section_display_name;
}
public function setSectionDisplayName(string $section_display_name): self
{
$this->section_display_name = $section_display_name;
return $this;
}
public function getManageableActions(): ?array
{
return $this->manageable_actions;
}
public function setManageableActions(?array $manageable_actions): self
{
$this->manageable_actions = $manageable_actions;
return $this;
}
public function getAccessModule(): ?AccessModules
{
return $this->access_module;
}
public function setAccessModule(?AccessModules $access_module): self
{
$this->access_module = $access_module;
return $this;
}
/**
* @return Collection<int, UserModuleSectionPermissions>
*/
public function getUserModuleSectionPermissions(): Collection
{
return $this->user_module_section_permissions;
}
public function addUserRightsModuleSectionRight(UserModuleSectionPermissions $userRightsModuleSectionRight): self
{
if (!$this->user_module_section_permissions->contains($userRightsModuleSectionRight)) {
$this->user_module_section_permissions[] = $userRightsModuleSectionRight;
$userRightsModuleSectionRight->setAccessModuleSection($this);
}
return $this;
}
public function removeUserRightsModuleSectionRight(UserModuleSectionPermissions $userRightsModuleSectionRight): self
{
if ($this->user_module_section_permissions->removeElement($userRightsModuleSectionRight)) {
// set the owning side to null (unless already changed)
if ($userRightsModuleSectionRight->getAccessModuleSection() === $this) {
$userRightsModuleSectionRight->setAccessModuleSection(null);
}
}
return $this;
}
}