ParameterRule
extends BaseEntity
in package
implements
ParameterRuleInterface, IdentifiableInterface
uses
IdentifiableTrait
AbstractYes
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'parameterRule'
Table of Contents
Interfaces
- ParameterRuleInterface
- Parameter rule: conditions (`conditions`) plus targets (`targets`).
- IdentifiableInterface
- Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).
Properties
- $action : int
- $conditionsCollection : Collection<int, ParameterRuleConditionInterface>
- $id : int|null
- $sourcesCollection : Collection<int, ParameterRuleSource>
- $targetsCollection : Collection<int, ParameterRuleTargetInterface>
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|string, mixed>
- 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, ParameterRuleConditionInterface>
- getId() : int|null
- getSources() : array<int, ParameterRuleSource>
- getSourcesCollection() : Collection<int, ParameterRuleSource>
- getTargets() : array<int|string, mixed>
- Elements are {@see ParameterRuleTargetInterface}; for why `mixed`, see {@see self::getConditions()}.
- getTargetsCollection() : Collection<int, ParameterRuleTargetInterface>
- 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, ParameterRuleConditionInterface>
$conditionsCollection
= new ArrayCollection()
$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
= new ArrayCollection()
$targetsCollection
protected
Collection<int, ParameterRuleTargetInterface>
$targetsCollection
= new ArrayCollection()
Methods
__construct()
public
__construct([int|null $id = null ][, int $action = self::ACTION_SHOW_SELECT_OPTIONS ][, Collection $conditionsCollection = new ArrayCollection() ][, Collection $sourcesCollection = new ArrayCollection() ][, Collection $targetsCollection = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $action : int = self::ACTION_SHOW_SELECT_OPTIONS
- $conditionsCollection : Collection = new ArrayCollection()
- $sourcesCollection : Collection = new ArrayCollection()
- $targetsCollection : Collection = new ArrayCollection()
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
intgetAllTraits()
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|string, mixed>
Return values
array<int|string, mixed>getConditionsCollection()
public
getConditionsCollection() : Collection<int, ParameterRuleConditionInterface>
Return values
Collection<int, ParameterRuleConditionInterface>getId()
public
getId() : int|null
Return values
int|nullgetSources()
public
getSources() : array<int, ParameterRuleSource>
Return values
array<int, ParameterRuleSource>getSourcesCollection()
public
getSourcesCollection() : Collection<int, ParameterRuleSource>
Return values
Collection<int, ParameterRuleSource>getTargets()
Elements are {@see ParameterRuleTargetInterface}; for why `mixed`, see {@see self::getConditions()}.
public
getTargets() : array<int|string, mixed>
Return values
array<int|string, mixed>getTargetsCollection()
public
getTargetsCollection() : Collection<int, ParameterRuleTargetInterface>
Return values
Collection<int, ParameterRuleTargetInterface>isPersisted()
public
isPersisted() : bool
Return values
boolsetAction()
public
setAction(int $action) : $this
Parameters
- $action : int
Return values
$thissetConditionsCollection()
public
setConditionsCollection(Collection<int, ParameterRuleConditionInterface>|array<int, ParameterRuleConditionInterface> $collection) : $this
Parameters
- $collection : Collection<int, ParameterRuleConditionInterface>|array<int, ParameterRuleConditionInterface>
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetSourcesCollection()
public
setSourcesCollection(Collection<int, ParameterRuleSource>|array<int, ParameterRuleSource> $collection) : $this
Parameters
- $collection : Collection<int, ParameterRuleSource>|array<int, ParameterRuleSource>
Return values
$thissetTargetsCollection()
public
setTargetsCollection(Collection<int, ParameterRuleTargetInterface>|array<int, ParameterRuleTargetInterface> $collection) : $this
Parameters
- $collection : Collection<int, ParameterRuleTargetInterface>|array<int, ParameterRuleTargetInterface>
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>