\Services_Model

Summary

Methods
Properties
Constants
__construct()
add()
insert()
update()
exists()
validate()
find_record_id()
delete()
get_row()
get_value()
get_batch()
get_available_services()
add_category()
delete_category()
get_category()
get_all_categories()
validate_category()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() 

Class Constructor

add()

add(array  $service) : \numeric

Add (insert or update) a service record on the database

Parameters

array $service

Contains the service data. If an 'id' value is provided then the record will be updated.

Returns

\numeric —

Returns the record id.

insert()

insert(array  $service) : integer

Insert service record into database.

Parameters

array $service

Contains the service record data.

Returns

integer —

Returns the new service record id.

update()

update(array  $service) 

Update service record.

Parameters

array $service

Contains the service data. The record id needs to be included in the array.

exists()

exists(array  $service) 

Checks whether an service record already exists in the database.

Parameters

array $service

Contains the service data. Name, duration and price values are mandatory in order to perform the checks.

validate()

validate(array  $service) : boolean

Validate a service record data.

Parameters

array $service

Contains the service data.

Returns

boolean —

Returns the validation result.

find_record_id()

find_record_id(array  $service) 

Get the record id of an existing record.

NOTICE! The record must exist, otherwise an exeption will be raised.

Parameters

array $service

Contains the service record data. Name, duration and price values are mandatory for this method to complete.

delete()

delete(\numeric  $service_id) : boolean

Delete a service record from database.

Parameters

\numeric $service_id

Record id to be deleted.

Returns

boolean —

Returns the delete operation result.

get_row()

get_row(\numeric  $service_id) : array

Get a specific row from the services db table.

Parameters

\numeric $service_id

The record's id to be returned.

Returns

array —

Returns an associative array with the selected record's data. Each key has the same name as the database field names.

get_value()

get_value(string  $field_name, integer  $service_id) : string

Get a specific field value from the database.

Parameters

string $field_name

The field name of the value to be returned.

integer $service_id

The selected record's id.

Returns

string —

Returns the records value from the database.

get_batch()

get_batch(  $where_clause = NULL) : array

Get all, or specific records from service's table.

Parameters

$where_clause

Returns

array —

Returns the rows from the database.

Examples

= ' . $recordId);
** File not found : $this->Model->getBatch('id **

get_available_services()

get_available_services() : array

This method returns all the services from the database.

Returns

array —

Returns an object array with all the database services.

add_category()

add_category(array  $category) : integer

Add (insert or update) a service category record into database.

Parameters

array $category

Containst the service category data.

Returns

integer —

Returns the record id.s

delete_category()

delete_category(\numeric  $category_id) : boolean

Delete a service category record from the database.

Parameters

\numeric $category_id

Record id to be deleted.

Returns

boolean —

Returns the delete operation result.

get_category()

get_category(\numeric  $category_id) : array

Get a service category record data.

Parameters

\numeric $category_id

Record id to be retrieved.

Returns

array —

Returns the record data from the database.

get_all_categories()

get_all_categories(  $where = '') : array

Get all service category records from database.

Parameters

$where

Returns

array —

Returns an array that contains all the service category records.

validate_category()

validate_category(array  $category) : boolean

Validate a service category record data. This method must be used before adding a service category record into database in order to secure the record integrity.

Parameters

array $category

Contains the service category data.

Returns

boolean —

Returns the validation result.