VarStoreDelete
extends ProcessorEntity
in package
Class VarStoreDelete
Processor class to delete a var-store variable.
Table of Contents
- $id : mixed
- Processor ID.
- $db : ADOConnection|null
- DB connections.
- $details : array<string|int, mixed>
- {@inheritDoc}
- $logger : MonologWrapper
- Logger object.
- $meta : array<string|int, mixed>
- Metadata for the processor.
- $request : Request
- All the request details.
- $applicationMapper : ApplicationMapper
- Account mapper class.
- $varStoreMapper : VarStoreMapper
- Var store mapper class.
- __construct() : mixed
- details() : array<string|int, mixed>
- Return details for processor.
- process() : DataContainer
- {@inheritDoc}
- val() : mixed|DataContainer
- Process a variable into a final result for the processor.
- filterParams() : array<string|int, mixed>
- Fetch the variables without any user role validation.
- filterVarsByPerms() : array<string|int, VarStore>
- Take an array of variables and return an array of variables the users has permissions for.
- generateParams() : array<string|int, mixed>
- Generate the params array for the sql search.
- isDataContainer() : bool
- Validate if a set of data is wrapped in a DataContainer object.
- validateAllowedTypes() : void
- Validate an input for allowed variable types
- validateAllowedValues() : void
- Validate an input for allowed values.
Properties
$id
Processor ID.
public
mixed
$id
= ''
Processor ID.
$db
DB connections.
protected
ADOConnection|null
$db
$details
{@inheritDoc}
protected
array<string|int, mixed>
$details
= [
'name' => 'Var store delete',
'machineName' => 'var_store_delete',
// phpcs:ignore
'description' => 'Delete single or multiple global variables. You can delete variables based on account/application, key or id.',
'menu' => 'Variables',
'input' => ['validate_access' => [
// phpcs:ignore
'description' => 'If set to true, the calling users roles access will be validated. If set to false, then access is open. By default this is true for security reasons, but to allow consumers to use this in a resource, you will need to set it to false (otherwise access will be denied).',
'cardinality' => [0, 1],
'literalAllowed' => true,
'limitProcessors' => [],
'limitTypes' => ['boolean'],
'limitValues' => [],
'default' => true,
], 'vid' => ['description' => 'Var store ID.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['integer'], 'limitValues' => [], 'default' => null], 'accid' => ['description' => 'Var store account ID.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['integer'], 'limitValues' => [], 'default' => null], 'appid' => ['description' => 'Var store application ID.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['integer'], 'limitValues' => [], 'default' => null], 'key' => ['description' => 'Var store key.', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['text'], 'limitValues' => [], 'default' => null], 'keyword' => ['description' => 'Filter variables to delete by keyword', 'cardinality' => [0, 1], 'literalAllowed' => true, 'limitProcessors' => [], 'limitTypes' => ['text'], 'limitValues' => [], 'default' => null]],
]
Details of the processor.
$logger
Logger object.
protected
MonologWrapper
$logger
$meta
Metadata for the processor.
protected
array<string|int, mixed>
$meta
$request
All the request details.
protected
Request
$request
Request.
$applicationMapper
Account mapper class.
private
ApplicationMapper
$applicationMapper
$varStoreMapper
Var store mapper class.
private
VarStoreMapper
$varStoreMapper
Methods
__construct()
public
__construct(array<string|int, mixed> &$meta, Request &$request, ADOConnection|null $db, MonologWrapper|null $logger) : mixed
Parameters
- $meta : array<string|int, mixed>
-
Metadata for the processor.
- $request : Request
-
The full request object.
- $db : ADOConnection|null
-
The DB connection object.
- $logger : MonologWrapper|null
-
The logger.
Return values
mixed —details()
Return details for processor.
public
details() : array<string|int, mixed>
Return values
array<string|int, mixed> —process()
{@inheritDoc}
public
process() : DataContainer
Tags
Return values
DataContainer —Result of the processor.
val()
Process a variable into a final result for the processor.
public
val(string $key[, bool|null $rawData = false ]) : mixed|DataContainer
This method can be used to process a value in its meta to return a final result that it can use. If the object is a processor, then it will process that down to a final return value, or if the obj is a simple value, then it will return that. Anything else will return an error object.
Setting $realValue to true will force the value to be the actual value, rather than a potential dataContainer.
Parameters
- $key : string
-
The key for the input variable in the meta.
- $rawData : bool|null = false
-
Return the raw data or a DataContainer.
Tags
Return values
mixed|DataContainer —filterParams()
Fetch the variables without any user role validation.
protected
filterParams(int|null $vid, int|null $accid, int|null $appid, string|null $key, string|null $keyword) : array<string|int, mixed>
Parameters
- $vid : int|null
-
Var ID filter.
- $accid : int|null
-
Account ID filter.
- $appid : int|null
-
Application ID filter.
- $key : string|null
-
Var name filter.
- $keyword : string|null
-
Var name search filter.
Return values
array<string|int, mixed> —filterVarsByPerms()
Take an array of variables and return an array of variables the users has permissions for.
protected
filterVarsByPerms(array<string|int, VarStore> $vars, array<string|int, mixed> $roles) : array<string|int, VarStore>
Parameters
- $vars : array<string|int, VarStore>
- $roles : array<string|int, mixed>
Tags
Return values
array<string|int, VarStore> —generateParams()
Generate the params array for the sql search.
protected
generateParams(string|null $keyword, array<string|int, mixed>|null $keywordCols, string|null $orderBy, string|null $direction) : array<string|int, mixed>
Parameters
- $keyword : string|null
-
Search keyword.
- $keywordCols : array<string|int, mixed>|null
-
Columns to search for the keyword.
- $orderBy : string|null
-
Order by column.
- $direction : string|null
-
Order direction.
Return values
array<string|int, mixed> —isDataContainer()
Validate if a set of data is wrapped in a DataContainer object.
protected
isDataContainer(mixed $data) : bool
Parameters
- $data : mixed
-
DataContainer or raw data.
Return values
bool —validateAllowedTypes()
Validate an input for allowed variable types
private
validateAllowedTypes(string $type, array<string|int, mixed> $limitTypes, int $min, string $key) : void
Parameters
- $type : string
-
Input value type.
- $limitTypes : array<string|int, mixed>
-
List of limit on variable types.
- $min : int
-
Minimum number of values.
- $key : string
-
The key of the input being validated.
Tags
Return values
void —validateAllowedValues()
Validate an input for allowed values.
private
validateAllowedValues(mixed $val, array<string|int, mixed> $limitValues, int $min, string $key) : void
Parameters
- $val : mixed
-
Input value.
- $limitValues : array<string|int, mixed>
-
List of allowed values.
- $min : int
-
Minimum number of values.
- $key : string
-
The key of the input being validated.