CoolCMS API

ParameterRule extends ParameterRule
in package
implements AdminParameterRuleInterface

Admin variant of a parameter or group display rule, hydrated from `api/comcat/parameter-rule`.

An owned aggregate: the rule plus its conditions, sources and targets (object-graph cascade). The rule editor of a parameter group lives in ParameterGroupFormTrait.

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_comcat_parameter_rules'
#[TableAlias]
'parameterRule'

Table of Contents

Interfaces

AdminParameterRuleInterface
Admin view of a parameter rule: conditions carry hydrated relations to the parameter and option (the shared interface knows only ids). The Admin `ParameterRule` entities of all modules implement it, so the Core admin layer (rule list, OptionRules) is not typed to module entities.

Properties

$action  : int
$conditionsCollection  : Collection<int, ParameterRuleCondition>
$id  : int|null
$sourcesCollection  : Collection<int, ParameterRuleSource>
$targetsCollection  : Collection<int, ParameterRuleTarget>

Methods

__construct()  : mixed
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
getAction()  : int
Legacy flag (1 reveals options, 2 hides them); it no longer decides the effect, see the class comment.
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getConditions()  : array<int, TCondition>
Elements are {@see ParameterRuleConditionInterface}. The type is `mixed` on purpose: module entities keep conditions in an untyped Doctrine `Collection`, so a stronger promise would be false. Only the `instanceof` guard in Core (`RulesTrait`/`DependentSelectTrait`) enforces it, so it must stay.
getConditionsCollection()  : Collection<int, TCondition>
getId()  : int|null
getSources()  : array<int, TSource>
getSourcesCollection()  : Collection<int, TSource>
getTargets()  : array<int, TTarget>
Elements are {@see ParameterRuleTargetInterface}; for why `mixed`, see {@see self::getConditions()}.
getTargetsCollection()  : Collection<int, TTarget>
isPersisted()  : bool
setAction()  : $this
setConditionsCollection()  : $this
setId()  : $this
setSourcesCollection()  : $this
setTargetsCollection()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$action

protected int $action = self::ACTION_SHOW_SELECT_OPTIONS
Attributes
#[Column]
$name: 'action'
$type: 'smallint'

$conditionsCollection

protected Collection<int, ParameterRuleCondition> $conditionsCollection
Attributes
#[CollectionOf]
\App\UI\Admin\Comcat\Models\Entities\ParameterRuleCondition::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Comcat\Models\Entities\ParameterRuleCondition::class
$mappedBy: 'rule'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'parameter_rule_id'
$type: 'bigint'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$sourcesCollection

protected Collection<int, ParameterRuleSource> $sourcesCollection
Attributes
#[CollectionOf]
\App\UI\Admin\Comcat\Models\Entities\ParameterRuleSource::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Comcat\Models\Entities\ParameterRuleSource::class
$mappedBy: 'rule'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

$targetsCollection

protected Collection<int, ParameterRuleTarget> $targetsCollection
Attributes
#[CollectionOf]
\App\UI\Admin\Comcat\Models\Entities\ParameterRuleTarget::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Comcat\Models\Entities\ParameterRuleTarget::class
$mappedBy: 'rule'
$cascade: ["persist", "remove"]
$orphanRemoval: true
$fetch: "LAZY"

Methods

__construct()

public __construct([int|null $id = null ][, int $action = self::ACTION_SHOW_SELECT_OPTIONS ]) : mixed
Parameters
$id : int|null = null
$action : int = self::ACTION_SHOW_SELECT_OPTIONS

callInitMethods()

Calls `init{TraitName}()` for every used trait that defines such a method.

public callInitMethods() : void

getAction()

Legacy flag (1 reveals options, 2 hides them); it no longer decides the effect, see the class comment.

public getAction() : int
Return values
int

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>

getConditions()

Elements are {@see ParameterRuleConditionInterface}. The type is `mixed` on purpose: module entities keep conditions in an untyped Doctrine `Collection`, so a stronger promise would be false. Only the `instanceof` guard in Core (`RulesTrait`/`DependentSelectTrait`) enforces it, so it must stay.

public getConditions() : array<int, TCondition>
Return values
array<int, TCondition>

getConditionsCollection()

public getConditionsCollection() : Collection<int, TCondition>
Return values
Collection<int, TCondition>

getSources()

public getSources() : array<int, TSource>
Return values
array<int, TSource>

getSourcesCollection()

public getSourcesCollection() : Collection<int, TSource>
Return values
Collection<int, TSource>

getTargets()

Elements are {@see ParameterRuleTargetInterface}; for why `mixed`, see {@see self::getConditions()}.

public getTargets() : array<int, TTarget>
Return values
array<int, TTarget>

getTargetsCollection()

public getTargetsCollection() : Collection<int, TTarget>
Return values
Collection<int, TTarget>

setAction()

public setAction(int $action) : $this
Parameters
$action : int
Return values
$this

setConditionsCollection()

public setConditionsCollection(Collection<int, TCondition>|array<int, TCondition> $collection) : $this
Parameters
$collection : Collection<int, TCondition>|array<int, TCondition>
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setSourcesCollection()

public setSourcesCollection(Collection<int, TSource>|array<int, TSource> $collection) : $this
Parameters
$collection : Collection<int, TSource>|array<int, TSource>
Return values
$this

setTargetsCollection()

public setTargetsCollection(Collection<int, TTarget>|array<int, TTarget> $collection) : $this
Parameters
$collection : Collection<int, TTarget>|array<int, TTarget>
Return values
$this

getTraitsRecursive()

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>
Return values
array<string, string>
On this page

Search results