ExtensionGeneratorExtensions extends ExtensionGeneratorModel
Extension Generator Extension Management
Table of Contents
Methods
| add() | Add an extension |
| delete() | Permanently deletes the given extension |
| edit() | Edit an extension |
| get() | Fetches the extension with the given ID |
| getAll() | Returns all extensions in the system for the given company |
| getFormTypes() | Gets a list of form types and their languages |
| getList() | Returns a list of extensions for the given company |
| getListCount() | Returns the total number of extension for the given company |
| getTypes() | Gets a list of extension types and their languages |
| getExtension() | Returns a partial extension query |
| getRules() | Returns all validation rules for adding/editing extensions |
Methods
add()
Add an extension
public
add(array<string|int, mixed> $vars) : int
Parameters
- $vars : array<string|int, mixed>
-
An array of input data including:
- company_id The ID of the company with which to associate the extension
- name The name of the extension
- type The type of the extension
- form_type The form type for creating/modifying the extension
- code_examples Whether to include commented code exampled when generating the extension
- data The save form data for the extension
Return values
int —The ID of the extension that was created, void on error
delete()
Permanently deletes the given extension
public
delete(int $extension_id) : mixed
Parameters
- $extension_id : int
-
The ID of the extension to delete
edit()
Edit an extension
public
edit(int $extension_id, array<string|int, mixed> $vars) : int
Parameters
- $extension_id : int
-
The ID of the extension to edit
- $vars : array<string|int, mixed>
-
An array of input data including:
- company_id The ID of the company with which to associate the extension
- name The name of the extension
- type The type of the extension
- form_type The form type for creating/modifying the extension
- code_examples Whether to include commented code exampled when generating the extension
- data The save form data for the extension
Return values
int —The ID of the extension that was updated, void on error
get()
Fetches the extension with the given ID
public
get(int $extension_id) : mixed
Parameters
- $extension_id : int
-
The ID of the extension to fetch
Return values
mixed —A stdClass object representing the extension, false if no such extension exists
getAll()
Returns all extensions in the system for the given company
public
getAll(int $company_id[, array<string|int, mixed> $order = ['date_updated' => 'desc'] ]) : array<string|int, mixed>
Parameters
- $company_id : int
-
The ID of the company to fetch extensions for
- $order : array<string|int, mixed> = ['date_updated' => 'desc']
-
A key/value pair array of fields to order the results by
Return values
array<string|int, mixed> —An array of stdClass objects, each representing an extension
getFormTypes()
Gets a list of form types and their languages
public
getFormTypes() : A
Return values
A —list of form types and their languages
getList()
Returns a list of extensions for the given company
public
getList(int $company_id[, int $page = 1 ][, array<string|int, mixed> $order = ['date_updated' => 'desc'] ]) : array<string|int, mixed>
Parameters
- $company_id : int
-
The ID of the company to fetch extensions from
- $page : int = 1
-
The page number of results to fetch
- $order : array<string|int, mixed> = ['date_updated' => 'desc']
-
A key/value pair array of fields to order the results by
Return values
array<string|int, mixed> —An array of stdClass objects, each representing an extension
getListCount()
Returns the total number of extension for the given company
public
getListCount(int $company_id) : int
Parameters
- $company_id : int
-
The ID of the company to fetch extension count from
Return values
int —The total number of extensions for the given company
getTypes()
Gets a list of extension types and their languages
public
getTypes() : A
Return values
A —list of extension types and their languages
getExtension()
Returns a partial extension query
private
getExtension([array<string|int, mixed> $filters = [] ]) : Record
Parameters
- $filters : array<string|int, mixed> = []
-
A list of filters for the query
- company_id The ID of the company to which the extensions must be assigned
Return values
Record —A partially built extension query
getRules()
Returns all validation rules for adding/editing extensions
private
getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
An array of input key/value pairs
- company_id The ID of the company with which to associate the extension
- name The name of the extension
- type The type of the extension
- form_type The form type for creating/modifying the extension
- code_examples Whether to include commented code exampled when generating the extension
- data The save form data for the extension
- date_updated The date this extension was updated
- $edit : bool = false
-
True if this if an edit, false otherwise
Return values
array<string|int, mixed> —An array of validation rules