Setting
extends Setting
in package
Attributes
- #[Entity]
- #[Table]
- $name: "cms_system_settings"
- #[TableAlias]
- "setting"
Table of Contents
Properties
- $isPublic : bool
- Whether this key may go out to the client.
- $key : string
- $module : int
- $value : string
Methods
- __construct() : mixed
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getId() : array{module: int, key: string}
- Setting has no surrogate id, the identity is the composite (`module` + `key`). The generic save layer (Manager/Service/Repository {@see \App\Core\Traits\Api\Models\Repositories\SaveTrait}) expects `getId()` and `isPersisted()` (otherwise `IdentifiableTrait`). Returns the composite identity as a property-to-value array so that `EntityManager::find()` accepts it and finds the existing row. The cache layer supports `int|array $id`.
- getKey() : string
- getModule() : int
- getValue() : string
- isPersisted() : bool
- Settings are always an upsert by (module, key): rows are pre-seeded (neon `%params%` plus db override). `true` makes the repository `save()` try `find()` and update; when the row does not exist yet, it falls through to insert. Correct in both cases.
- isPublic() : bool
- setIsPublic() : $this
- setKey() : $this
- setModule() : $this
- setValue() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$isPublic
Whether this key may go out to the client.
protected
bool
$isPublic
= false
Fail-closed: the default is false in both PHP and the db (not null default 0,
docs/sql/2026-08-04_10_setting_public_flag.sql). A newly inserted key is private, so a
future email.smtp.password does not leak silently but only after a deliberate switch.
Controls exclusively what :Api:System:Setting:getPublicMerged returns (and so what goes to
the front end over the wire). getMerged / getAll are admin-only and ignore the flag: it
filters what is returned, not who calls.
Named is_public (not public): public is reserved since MySQL 8.0.31, and is_* matches
the schema convention (is_default, is_company, is_managed).
Attributes
- #[Column]
- $name: 'is_public'
- $type: "boolean"
- $options: ["default" => 0]
$key
protected
string
$key
= ''
Attributes
- #[Column]
- $name: '`key`'
- $type: "string"
- $length: 50
- #[Id]
- #[Identity]
$module
protected
int
$module
= 0
Attributes
- #[Column]
- $type: "integer"
- $options: ["unsigned" => true]
- #[Id]
- #[Identity]
$value
protected
string
$value
= ''
Attributes
- #[Column]
- $type: "string"
- $length: 255
Methods
__construct()
public
__construct([int $module = 0 ][, string $key = '' ][, string $value = '' ][, bool $isPublic = false ]) : mixed
Parameters
- $module : int = 0
- $key : string = ''
- $value : string = ''
- $isPublic : bool = false
callInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getAllTraits()
Returns all traits the class uses, including those used by parent classes and nested traits.
public
getAllTraits() : array<string, string>
Return values
array<string, string>getId()
Setting has no surrogate id, the identity is the composite (`module` + `key`). The generic save layer (Manager/Service/Repository {@see \App\Core\Traits\Api\Models\Repositories\SaveTrait}) expects `getId()` and `isPersisted()` (otherwise `IdentifiableTrait`). Returns the composite identity as a property-to-value array so that `EntityManager::find()` accepts it and finds the existing row. The cache layer supports `int|array $id`.
public
getId() : array{module: int, key: string}
Return values
array{module: int, key: string}getKey()
public
getKey() : string
Return values
stringgetModule()
public
getModule() : int
Return values
intgetValue()
public
getValue() : string
Return values
stringisPersisted()
Settings are always an upsert by (module, key): rows are pre-seeded (neon `%params%` plus db override). `true` makes the repository `save()` try `find()` and update; when the row does not exist yet, it falls through to insert. Correct in both cases.
public
isPersisted() : bool
Return values
boolisPublic()
public
isPublic() : bool
Return values
boolsetIsPublic()
public
setIsPublic(bool $isPublic) : $this
Parameters
- $isPublic : bool
Return values
$thissetKey()
public
setKey(string $key) : $this
Parameters
- $key : string
Return values
$thissetModule()
public
setModule(int $module) : $this
Parameters
- $module : int
Return values
$thissetValue()
public
setValue(string $value) : $this
Parameters
- $value : string
Return values
$thisgetTraitsRecursive()
Walks the trait list recursively and collects nested traits too.
private
static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
- $traits : array<string, string>