Documentation

tab_worktime_types

Class tab_worktime_types

This class provides methods for interacting with the worktime_types table in the database.

Table of Contents

Properties

$allowedCols  : array<string|int, mixed>
$db  : db_master

Methods

__construct()  : void
Constructor for the class.
__destruct()  : void
Destructor method for the class.
all()  : array<string|int, mixed>|bool
Fetch and return all records from the `worktime_types` table.
delete()  : bool
Deletes a record from the 'worktime_types' table based on the given value and column.
get()  : array<string|int, mixed>|bool
Fetch and return a single record from the `worktime_types` table based on the given value and column.
insert()  : bool
Inserts a new record into the 'worktime_types' table with the given name.
update()  : bool
Updates the 'name' field of a record in the 'worktime_types' table based on the given id.

Properties

$allowedCols

protected array<string|int, mixed> $allowedCols = ['id', 'name']

Specifies the allowed columns for a certain operation. It is an array containing the names of the columns that are allowed. The order and the number of elements matter.

Methods

__construct()

Constructor for the class.

public __construct() : void

Initializes the class by setting the global database manager instance to the class property.

__destruct()

Destructor method for the class.

public __destruct() : void

Cleanup any resources and objects used by the class.

all()

Fetch and return all records from the `worktime_types` table.

public all([string $sort = 'id' ][, string $order = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
$sort : string = 'id'

(Optional) The column to sort the records by. Defaults to 'id'.

$order : string = 'ASC'

(Optional) The order in which to sort the records. Defaults to 'ASC'.

Return values
array<string|int, mixed>|bool

Returns an array of records if there are any, otherwise returns false.

delete()

Deletes a record from the 'worktime_types' 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 specified column.

$col : string = 'id'

The column name to use for matching. Defaults to 'id' if not specified or invalid.

Return values
bool

True if the record was successfully deleted, false otherwise.

get()

Fetch and return a single record from the `worktime_types` table based on the given value and column.

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'

(Optional) The column to search for the value in. Defaults to 'id'.

Return values
array<string|int, mixed>|bool

Returns an array representing the record if found, otherwise returns false.

insert()

Inserts a new record into the 'worktime_types' table with the given name.

public insert(string $name) : bool
Parameters
$name : string

The name to be inserted.

Return values
bool

Returns true if the name was successfully inserted, false otherwise.

update()

Updates the 'name' field of a record in the 'worktime_types' table based on the given id.

public update(string $name, string $id) : bool
Parameters
$name : string

The new value for the 'name' field.

$id : string

The id of the record to update.

Return values
bool

True if the record was successfully updated, false otherwise.


        
On this page

Search results