src/Entity/AclSetting.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Model\AclSettingConfig;
  4. use App\Repository\AclSettingRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8. * @ORM\Entity(repositoryClass=AclSettingRepository::class)
  9. *
  10. * @UniqueEntity(fields={"env", "route", "params", "component", "slug", "role", "job", "action"})
  11. */
  12. class AclSetting
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\GeneratedValue
  17. * @ORM\Column(type="integer")
  18. */
  19. private $id;
  20. /**
  21. * @deprecated
  22. * @ORM\Column(type="text", nullable=true)
  23. */
  24. private $concatKey;
  25. /**
  26. * @ORM\Column(type="boolean")
  27. */
  28. private $value;
  29. /**
  30. * @ORM\Column(type="string", length=255, nullable=true)
  31. */
  32. private $env;
  33. /**
  34. * @ORM\Column(type="string", length=255, nullable=true)
  35. */
  36. private $route;
  37. /**
  38. * @ORM\Column(type="text", nullable=true)
  39. */
  40. private $params;
  41. /**
  42. * @ORM\Column(type="text", nullable=true)
  43. */
  44. private $component;
  45. /**
  46. * @ORM\Column(type="text", nullable=true)
  47. */
  48. private $slug;
  49. /**
  50. * @ORM\Column(type="string", length=255, nullable=true)
  51. */
  52. private $role;
  53. /**
  54. * @ORM\Column(type="string", length=255, nullable=true)
  55. */
  56. private $action;
  57. /**
  58. * @ORM\Column(type="string", length=255, nullable=true)
  59. */
  60. private $job;
  61. public function getId(): ?int
  62. {
  63. return $this->id;
  64. }
  65. public function getConcatKey(): ?string
  66. {
  67. return $this->concatKey;
  68. }
  69. public function setConcatKey(?string $concatKey): self
  70. {
  71. $this->concatKey = $concatKey;
  72. return $this;
  73. }
  74. public function getValue(): ?bool
  75. {
  76. return $this->value;
  77. }
  78. public function setValue(bool $value): self
  79. {
  80. $this->value = $value;
  81. return $this;
  82. }
  83. public function getEnv(): ?string
  84. {
  85. return $this->env;
  86. }
  87. public function setEnv(?string $env): self
  88. {
  89. $this->env = $env;
  90. return $this;
  91. }
  92. public function getRoute(): ?string
  93. {
  94. return $this->route;
  95. }
  96. public function setRoute(?string $route): self
  97. {
  98. $this->route = $route;
  99. return $this;
  100. }
  101. public function getParams(): ?string
  102. {
  103. return $this->params;
  104. }
  105. public function setParams(?string $params): self
  106. {
  107. $this->params = $params;
  108. return $this;
  109. }
  110. public function getComponent(): ?string
  111. {
  112. return $this->component;
  113. }
  114. public function setComponent(?string $component): self
  115. {
  116. $this->component = $component;
  117. return $this;
  118. }
  119. public function getSlug(): ?string
  120. {
  121. return $this->slug;
  122. }
  123. public function setSlug(?string $slug): self
  124. {
  125. $this->slug = $slug;
  126. return $this;
  127. }
  128. public function getRole(): ?string
  129. {
  130. return $this->role;
  131. }
  132. public function setRole(?string $role): self
  133. {
  134. $this->role = $role;
  135. return $this;
  136. }
  137. public function getAction(): ?string
  138. {
  139. return $this->action;
  140. }
  141. public function setAction(?string $action): self
  142. {
  143. $this->action = $action;
  144. return $this;
  145. }
  146. public function getJob(): ?string
  147. {
  148. return $this->job;
  149. }
  150. public function setJob(?string $job): self
  151. {
  152. $this->job = $job;
  153. return $this;
  154. }
  155. public function setFromAclSettingConfig(AclSettingConfig $config): AclSetting
  156. {
  157. foreach ($config->toArray() as $key => $value) {
  158. $setter = 'set' . ucfirst($key);
  159. if (method_exists($this, $setter)) {
  160. $this->$setter($value);
  161. }
  162. }
  163. return $this;
  164. }
  165. }