Methods summary
public
|
#
__construct( )
Initialize PackageGroups
Overrides
|
public
array
|
#
getTypes( )
Returns a list of supported package group types
Returns a list of supported package group types
Returns
array A list of package group types and their language name
|
public
integer
|
#
getTypeCount( integer $company_id, string $type = 'standard', array $filters = [] )
Retrieves the number of package groups of a given type
Retrieves the number of package groups of a given type
Parameters
- $company_id
- The ID of the company whose package groups to count
- $type
- The type of package groups to count ("standard" or "addon", default "standard")
- $filters
A list of package groups filters including:
- hidden Whether or nor to include the hidden package groups
Returns
integer The number of package groups of the given type
|
public
mixed
|
#
get( integer $package_group_id )
Returns a package group
Parameters
- $package_group_id
- The package group ID
Returns
mixed An stdClass object representing the package group, or false if the package group does not exist
|
public
array
|
#
getAll( integer $company_id, string $type = null, array $order_by = ['name' => 'asc'] )
Fetches all package groups for a given company
Fetches all package groups for a given company
Parameters
- $company_id
- The company ID
- $type
- The type of package group to get ('standard' or 'addon', optional, default both)
- $order_by
- The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
Returns
array An array of stdClass objects representing each package group
|
public
array
|
#
getList( integer $company_id, integer $page = 1, string $type = null, array $order_by = ['name' => 'asc'], array $filters = [] )
Fetches a list of all package groups for a given company
Fetches a list of all package groups for a given company
Parameters
- $company_id
- The company ID to fetch package groups for
- $page
- The page to return results for
- $type
- The type of package group to get ("standard" or "addon", null for both)
- $order_by
- The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
- $filters
A list of package groups filters including:
- hidden Whether or nor to include the hidden package groups
Returns
array An array of objects, each representing a package group
|
public
integer
|
#
getListCount( integer $company_id, string $type = null, array $filters = [] )
Return the total number of package groups returned from PackageGroups::getList(),
useful in constructing pagination for the getList() method.
Return the total number of package groups returned from PackageGroups::getList(),
useful in constructing pagination for the getList() method.
Parameters
- $company_id
- The company ID to fetch package groups for
- $type
- The type of package group to get ("standard" or "addon", null for both)
- $filters
A list of package groups filters including:
- hidden Whether or nor to include the hidden package groups
Returns
integer The total number of package groups
See
|
public
integer
|
#
add( array $vars )
Adds a package group for the given company
Adds a package group for the given company
Parameters
- $vars
An array of package group info including:
- company_id The ID for the company under which to add the package group
- names A list of names for the package group in different languages, each including:
- lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
- name The name in the specified language
- type The package group type, ('standard', or 'addon', optional, default 'standard')
- descriptions A list of descriptions for this package group in different languages (optional)
- lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
- description The description in the specified language (optional, default null)
- parents If type is 'addon', an array of 'standard' package groups this group belongs to
- allow_upgrades Whether or not packages within this group can be changed:
- 1 = true, 0 = false (optional, default 1)
Returns
integer The package group ID, void on error
|
public
|
#
edit( integer $package_group_id, array $vars )
Updates a package group
Parameters
- $package_group_id
- The package group ID to update
- $vars
An array of package group info including:
- company_id The ID for the company to which this package group belongs
- names A list of names for the package group in different languages
- lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
- name The name in the specified language
- type The package group type, 'standard', or 'addon' (optional, default standard)
- descriptions A list of descriptions for this package group in different languages (optional)
- lang The language in ISO 636-1 2-char + "_" + ISO 3166-1 2-char (e.g. en_us)
- description The description in the specified language (optional, default null)
- parents If type is 'addon', a numerically indexed array of 'standard' package groups this group belongs to
- allow_upgrades Whether or not packages within this group can be changed
- 1 = true, 0 = false (optional, default 1)
|
public
|
#
delete( integer $package_group_id )
Permanently removes a package group from the system.
Permanently removes a package group from the system.
Parameters
- $package_group_id
- The package group ID to delete
|
public
boolean
|
#
validateGroupParents( array $parents, integer $company_id, string $type )
Checks to ensure that every group parent consists of valid data
Checks to ensure that every group parent consists of valid data
Parameters
- $parents
- A numerically-indexed array of parent group IDs
- $company_id
- The company ID to which this group belongs
- $type
- The type of group
Returns
boolean True if every group parent consists of valid data, false otherwise
|
public
boolean
|
#
validateType( string $type )
Validates that the given type is a valid package group type
Validates that the given type is a valid package group type
Parameters
- $type
- The package group type
Returns
boolean True if the package group type is valid, false otherwise
|