Methods summary
public
|
#
__construct( )
Initialize PackageOptionGroups
Initialize PackageOptionGroups
Overrides
|
public
mixed
|
#
get( integer $option_group_id )
Fetches the package option group
Fetches the package option group
Parameters
- $option_group_id
- The ID of the package option group to fetch
Returns
mixed A stdClass object representing the package option group, false if no such group exists
|
public
array
|
#
getAll( integer $company_id )
Fetches all package option groups for a given company
Fetches all package option groups for a given company
Parameters
- $company_id
- The company ID
Returns
array An array of stdClass objects representing each package option group
|
public
array
|
#
getAllPackageIds( integer $option_group_id )
Fetches the package IDs of all packages assigned to this package option group
Fetches the package IDs of all packages assigned to this package option group
Parameters
- $option_group_id
- The ID of the package option group whose assigned packages to fetch
Returns
array An array of stdClass objects representing
|
public
array
|
#
getAllOptions( integer $option_group_id )
Fetches all package options assigned to this package option group
Fetches all package options assigned to this package option group
Parameters
- $option_group_id
- The ID of the package option group whose package options to fetch
Returns
array An array of stdClass objects representing each package option group
|
public
array
|
#
getList( integer $company_id, integer $page = 1, array $order_by = ['name' => 'asc'] )
Fetches a list of all package option groups for a given company
Fetches a list of all package option groups for a given company
Parameters
- $company_id
- The company ID to fetch package option groups for
- $page
- The page to return results for
- $order_by
- The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
Returns
array An array of objects, each representing a package option group
|
public
integer
|
#
getListCount( integer $company_id )
Returns the total number of package option groups returned from PackageOptionGroups::getList(),
useful in constructing pagination for the getList() method.
Returns the total number of package option groups returned from PackageOptionGroups::getList(),
useful in constructing pagination for the getList() method.
Parameters
- $company_id
- The company ID to fetch package option groups for
Returns
integer The total number of package option groups
See
|
public
integer
|
#
add( array $vars )
Adds a package option group for the given company
Adds a package option group for the given company
Parameters
- $vars
An array of package option group info including:
- company_id The ID for the company under which to add the package option group
- name The package option group name
- description The description of the group
- packages A list of package IDs to assign to this option group (optional)
Returns
integer The package option group ID, void on error
|
public
integer
|
#
edit( integer $option_group_id, array $vars )
Updates a package option group
Updates a package option group
Parameters
- $option_group_id
- The ID of the package option group to update
- $vars
An array of package option group info including:
- name The package option group name
- description The description of the group
- packages A list of package IDs to assign to this option group (optional)
Returns
integer The package option group ID, void on error
|
public
|
#
delete( integer $option_group_id )
Permanently removes a package option group from the system
Permanently removes a package option group from the system
Parameters
- $option_group_id
- The package option group ID to delete
|
public
|
#
orderOptions( integer $option_group_id, array $option_ids )
Save the package options for the given group in the provided order
Save the package options for the given group in the provided order
Parameters
- $option_group_id
- The ID of the group to order options for
- $option_ids
- A numerically indexed array of option IDs
|
public
boolean
|
#
validatePackage( integer $package_id, integer $company_id = null, integer $option_group_id = null )
Validates that the given group is valid
Validates that the given group is valid
Parameters
- $package_id
- The ID of the package to validate
- $company_id
The ID of the company the package should belong
to (optional, required if $option_group_id not given, default null)
- $option_group_id
The ID of the option group that the package
is to be assigned to (optional, required if $company_id not given, default null)
Returns
boolean True if the package option group is valid, or false otherwise
|