src/Entity/AccessModuleSections.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AccessModuleSectionsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. /**
  10.  * @ORM\Entity(repositoryClass=AccessModuleSectionsRepository::class)
  11.  * @ORM\Table(name="access_module_sections", options={"comment"="This table stores the user right modules sections, extended AccessModules"})
  12.  *
  13.  * @UniqueEntity(
  14.  *       fields={"section_key", "access_module"},
  15.  *       message="Module section already registered | Module section with combination (%s %s) is already registered"
  16.  *   )
  17.  *   */
  18. class AccessModuleSections
  19. {
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      * @Groups({
  25.      *     "right.module.section.core",
  26.      *     "user_right_module_section@open_api",
  27.      *
  28.      *     "access_module_section@core"
  29.      * })
  30.      */
  31.     private $id;
  32.     /**
  33.      * @ORM\Column(type="string", length=64)
  34.      * @Groups({
  35.      *     "right.module.section.core",
  36.      *     "user_right_module_section@open_api",
  37.      *
  38.      *     "access_module_section@core"
  39.      * })
  40.      */
  41.     private $section_key;
  42.     /**
  43.      * @ORM\Column(type="string", length=64)
  44.      * @Groups({
  45.      *      "right.module.section.core",
  46.      *      "user_right_module_section@open_api",
  47.      *
  48.      *     "access_module_section@core"
  49.      *  })
  50.      */
  51.     private $section_display_name;
  52.     /**
  53.      * @ORM\Column(type="json", nullable=true)
  54.      * @Groups({
  55.      *     "right.module.section.core",
  56.      *
  57.      *     "access_module_section@core"
  58.      * })
  59.      */
  60.     private $manageable_actions = [];
  61.     /**
  62.      * @ORM\ManyToOne(targetEntity=AccessModules::class, inversedBy="access_module_sections")
  63.      * @Groups({
  64.      *      "access_module_section@access_module"
  65.      *  })
  66.      * @ORM\JoinColumn(onDelete="CASCADE")
  67.      */
  68.     private $access_module;
  69.     /**
  70.      * Bunu Kullanma -> User Rights Kullan
  71.      * @ORM\OneToMany(targetEntity=UserModuleSectionPermissions::class, mappedBy="user_module_section")
  72.      * @Groups({
  73.      *     "user_right_module_section@section_rights"
  74.      * })
  75.      */
  76.     private $user_module_section_permissions;
  77.     public function __construct()
  78.     {
  79.         $this->user_module_section_permissions = new ArrayCollection();
  80.     }
  81.     public function getId(): ?int
  82.     {
  83.         return $this->id;
  84.     }
  85.     public function getSectionKey(): ?string
  86.     {
  87.         return $this->section_key;
  88.     }
  89.     public function setSectionKey(string $section_key): self
  90.     {
  91.         $this->section_key $section_key;
  92.         return $this;
  93.     }
  94.     public function getSectionDisplayName(): ?string
  95.     {
  96.         return $this->section_display_name;
  97.     }
  98.     public function setSectionDisplayName(string $section_display_name): self
  99.     {
  100.         $this->section_display_name $section_display_name;
  101.         return $this;
  102.     }
  103.     public function getManageableActions(): ?array
  104.     {
  105.         return $this->manageable_actions;
  106.     }
  107.     public function setManageableActions(?array $manageable_actions): self
  108.     {
  109.         $this->manageable_actions $manageable_actions;
  110.         return $this;
  111.     }
  112.     public function getAccessModule(): ?AccessModules
  113.     {
  114.         return $this->access_module;
  115.     }
  116.     public function setAccessModule(?AccessModules $access_module): self
  117.     {
  118.         $this->access_module $access_module;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Collection<int, UserModuleSectionPermissions>
  123.      */
  124.     public function getUserModuleSectionPermissions(): Collection
  125.     {
  126.         return $this->user_module_section_permissions;
  127.     }
  128.     public function addUserRightsModuleSectionRight(UserModuleSectionPermissions $userRightsModuleSectionRight): self
  129.     {
  130.         if (!$this->user_module_section_permissions->contains($userRightsModuleSectionRight)) {
  131.             $this->user_module_section_permissions[] = $userRightsModuleSectionRight;
  132.             $userRightsModuleSectionRight->setAccessModuleSection($this);
  133.         }
  134.         return $this;
  135.     }
  136.     public function removeUserRightsModuleSectionRight(UserModuleSectionPermissions $userRightsModuleSectionRight): self
  137.     {
  138.         if ($this->user_module_section_permissions->removeElement($userRightsModuleSectionRight)) {
  139.             // set the owning side to null (unless already changed)
  140.             if ($userRightsModuleSectionRight->getAccessModuleSection() === $this) {
  141.                 $userRightsModuleSectionRight->setAccessModuleSection(null);
  142.             }
  143.         }
  144.         return $this;
  145.     }
  146. }