CoolCMS API

RelationTogglable

Grid data source that can switch a link in a join table. The row cell ({@see \App\UI\Admin\System\Components\DataGridComponent\Columns\RelationColumn}) is not an entity column but a flag from a related collection selected by a "scope" (e.g. RBAC matrix: row = privilege, column = role → `allowed`).

The relationToggle! signal (HandleTrait::handleRelationToggle()) delegates to this method, unlike inline update (updateColumns), which would write a column on the row, not a join row with a composite key.

Table of Contents

Methods

toggleRelation()  : Result
Sets the link flag (rowId × scope) → value.

Methods

toggleRelation()

Sets the link flag (rowId × scope) → value.

public toggleRelation(int $rowId, int|string $scope, bool $value) : Result
Parameters
$rowId : int

primary key of the row (e.g. privilegeId)

$scope : int|string

identifier of the link column (e.g. roleId)

$value : bool

target state of the link

Return values
Result
On this page

Search results