ModuleTypes extends AppModel
Module Types Management
Table of Contents
Methods
| __construct() | Initialize ModuleTypes |
| add() | Adds a new module type to the system |
| delete() | Deletes a module type |
| deleteByName() | Deletes a module type by it's name |
| edit() | Updates an existing module type |
| get() | Fetches a single module type |
| getAll() | Fetches all the module types available in the system |
| getByName() | Fetches a single module type by it's name |
| getDefaultTypes() | Returns a list of default module types |
| getList() | Returns a list of all module types on the system |
| getRules() | Returns the rules to validate the module type |
Methods
__construct()
Initialize ModuleTypes
public
__construct() : mixed
add()
Adds a new module type to the system
public
add(array<string|int, mixed> $vars) : int
Parameters
- $vars : array<string|int, mixed>
-
An array of module type data including:
- name The name of the new module type
Return values
int —The ID of the module type, void on error
delete()
Deletes a module type
public
delete(int $type_id) : mixed
Parameters
- $type_id : int
-
The ID of the module type to delete
deleteByName()
Deletes a module type by it's name
public
deleteByName(string $name) : mixed
Parameters
- $name : string
-
The module type name to delete
edit()
Updates an existing module type
public
edit(int $type_id, array<string|int, mixed> $vars) : mixed
Parameters
- $type_id : int
-
The id of the module type to update
- $vars : array<string|int, mixed>
-
An array of module type data including:
- name The name of the new module type
get()
Fetches a single module type
public
get(int $type_id) : stdClass
Parameters
- $type_id : int
-
The ID of the module type to fetch
Return values
stdClass —A class containing the id and name of the module type
getAll()
Fetches all the module types available in the system
public
getAll([string $sort_by = 'name' ][, string $order = 'asc' ]) : array<string|int, mixed>
Parameters
- $sort_by : string = 'name'
-
The field to sort by
- $order : string = 'asc'
-
The direction to order results
Return values
array<string|int, mixed> —A numerically indexed array containing the module types
getByName()
Fetches a single module type by it's name
public
getByName(string $name) : stdClass
Parameters
- $name : string
-
The name of the module type to fetch
Return values
stdClass —A class containing the id and name of the module type
getDefaultTypes()
Returns a list of default module types
public
getDefaultTypes() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of default module types
getList()
Returns a list of all module types on the system
public
getList() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of all module types
getRules()
Returns the rules to validate the module type
private
getRules([array<string|int, mixed> $vars = [] ][, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed> = []
-
The input vars
- $edit : bool = false
-
Whether the module type is being edited (optional)
Return values
array<string|int, mixed> —A list of rules