main
in package
Class main
Represents a class for managing ticket types records in a database table.
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor for the class.
- __destruct() : void
- Destructor method.
- all() : array<string|int, mixed>|bool
- Retrieve all ticket types.
- delete() : bool
- Delete records from tticketstypes table based on the given value and column.
- get() : array<string|int, mixed>|bool
- Retrieve a specific ticket type.
- insert() : bool
- Insert a new ticket type.
- update() : bool
- Update records in tticketstypes table based on the given value, column, and ID.
Properties
$tticketstypes
protected
tab_tickets_types
$tticketstypes
Represents the tab_tickets_types class.
Methods
__construct()
Constructor for the class.
public
__construct() : mixed
Initializes a new instance of the class and assigns a new tab_tickets_types object to the $tticketstypes property.
__destruct()
Destructor method.
public
__destruct() : void
Unsets the $tticketstypes
property to free up memory.
all()
Retrieve all ticket types.
public
all([string $sort = 'id' ][, string $order = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
- $sort : string = 'id'
-
The column to sort the results by. Default is 'id'.
- $order : string = 'ASC'
-
The order to sort the results in. Default is 'ASC'.
Return values
array<string|int, mixed>|bool —An array of ticket type objects, or false if failed to retrieve.
delete()
Delete records from tticketstypes table based on the given value and column.
public
delete(string $val[, string $col = 'id' ]) : bool
Parameters
- $val : string
-
The value to match against the column's value.
- $col : string = 'id'
-
The column name to search for the value. Defaults to 'id'.
Return values
bool —Returns true if the deletion is successful, false otherwise.
get()
Retrieve a specific ticket type.
public
get(string $val[, string $col = 'id' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'id'
-
The column to search for the specified value. Default is 'id'.
Return values
array<string|int, mixed>|bool —An array representing the ticket type object, or false if failed to retrieve.
insert()
Insert a new ticket type.
public
insert(string $name, string $icon, string $bg, string $cssicon) : bool
Parameters
- $name : string
-
The name of the ticket type.
- $icon : string
-
The icon of the ticket type.
- $bg : string
-
The background color of the ticket type.
- $cssicon : string
-
The CSS class for the icon of the ticket type.
Return values
bool —Returns true if the insertion was successful and false otherwise.
update()
Update records in tticketstypes table based on the given value, column, and ID.
public
update(string $val, string $col, string $id) : bool
Parameters
- $val : string
-
The new value to update.
- $col : string
-
The column name to search for the ID.
- $id : string
-
The ID of the record to update.
Return values
bool —Returns true if the update is successful, false otherwise.