Blesta Source Documentation

PackageOptionConditions extends AppModel

Package Option Condition management

Table of Contents

Methods

__construct() Initialize PackageOptionConditions
add() Adds a package option condition
delete() Permanently removes a package option condition from the system
edit() Updates a package option condition
get() Fetches the package option condition
getAll() Fetches all package option conditions
getOperators() Retrieves a list of package option condition operators and their language definitions
formatCondition() Formats the given package option condition
getConditions() Partially-constructs the Record object for fetching package option conditions
getRules() Retrieves a list of rules for adding/editing package option conditions
Methods

add()

Adds a package option condition

public add(array<string|int, mixed> $vars) : int
Parameters
$vars : array<string|int, mixed>

An array of package option condition info including:

  • condition_set_id The ID of the set to which this condition belongs
  • trigger_option_id The ID of the option that triggers evaluation of this condition
  • operator The comparison operator used to evaluate this condition (>, <, =, !=, in)
  • value The value to compare this option against
  • value_id The ID of the value to compare this option against
Return values
int

The package option condition ID, void on error

delete()

Permanently removes a package option condition from the system

public delete(int $condition_id) : mixed
Parameters
$condition_id : int

The package option condition ID to delete

edit()

Updates a package option condition

public edit(int $condition_id, array<string|int, mixed> $vars) : int
Parameters
$condition_id : int

The ID of the package option condition to update

$vars : array<string|int, mixed>

An array of package option condition info including:

  • id The ID of the condition
  • condition_set_id The ID of the set to which this condition belongs
  • trigger_option_id The ID of the option that triggers evaluation of this condition
  • operator The comparison operator used to evaluate this condition (>, <, =, !=, in)
  • value The value to compare this option against
  • value_id The ID of the value to compare this option against
Return values
int

The package option condition ID, void on error

get()

Fetches the package option condition

public get(int $condition_id) : mixed
Parameters
$condition_id : int

The ID of the package option condition to fetch

Return values
mixed

A stdClass object representing the package option, false if no such option exists

getAll()

Fetches all package option conditions

public getAll([array<string|int, mixed> $filters = [] ]) : array<string|int, mixed>
Parameters
$filters : array<string|int, mixed> = []

A list of filters:

  • id The ID of the condition
  • condition_set_id The ID of the set to which this condition belongs
  • trigger_option_id The ID of the option that triggers evaluation of this condition
  • operator The comparison operator used to evaluate this condition (>, <, =, !=, in)
  • value The value to compare this option against
  • value_id The ID of the value to compare this option against
Return values
array<string|int, mixed>

An array of stdClass objects representing each package option condition

getOperators()

Retrieves a list of package option condition operators and their language definitions

public getOperators() : array<string|int, mixed>
Return values
array<string|int, mixed>

A key/value list of operators and their language

formatCondition()

Formats the given package option condition

private formatCondition(stdClass|false $condition) : stdClass|false
Parameters
$condition : stdClass|false

An object representing a package option condition

Return values
stdClass|false

The formatted object

getConditions()

Partially-constructs the Record object for fetching package option conditions

private getConditions([array<string|int, mixed> $filters = [] ][, bool $select = true ]) : Record
Parameters
$filters : array<string|int, mixed> = []

A list of filters:

  • id The ID of the condition
  • condition_set_id The ID of the set to which this condition belongs
  • trigger_option_id The ID of the option that triggers evaluation of this condition
  • operator The comparison operator used to evaluate this condition (>, <, =, !=, in)
  • value The value to compare this option against
  • value_id The ID of the value to compare this option against
$select : bool = true

Whether to select field in the query

Return values
Record

A partially-constructed Record object

getRules()

Retrieves a list of rules for adding/editing package option conditions

private getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

A list of input vars used in validation

  • id The ID of the condition
  • condition_set_id The ID of the set to which this condition belongs
  • trigger_option_id The ID of the option that triggers evaluation of this condition
  • operator The comparison operator used to evaluate this condition (>, <, =, !=, in)
  • value The value to compare this option against
  • value_id The ID of the value to compare this option against
$edit : bool = false

True to fetch the edit rules, false for the add rules (optional, default false)

Return values
array<string|int, mixed>

A list of rules

Tags
subpackage

app.models

copyright

Copyright (c) 2021, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results