Methods summary
public
|
|
public
numeric
|
#
add( array $service )
Add (insert or update) a service record on the database
Add (insert or update) a service record on the database
Parameters
- $service
array $service Contains the service data. If an 'id' value is provided then the record
will be updated.
Returns
numeric Returns the record id.
|
public
integer
|
#
insert( array $service )
Insert service record into database.
Insert service record into database.
Parameters
- $service
array $service Contains the service record data.
Returns
integer Returns the new service record id.
|
public
|
#
update( array $service )
Update service record.
Parameters
- $service
array $service Contains the service data. The record id needs to be included in the
array.
|
public
|
#
exists( array $service )
Checks whether an service record already exists in the database.
Checks whether an service record already exists in the database.
Parameters
- $service
array $service Contains the service data. Name, duration and price values are
mandatory in order to perform the checks.
|
public
boolean
|
#
validate( array $service )
Validate a service record data.
Validate a service record data.
Parameters
- $service
array $service Contains the service data.
Returns
boolean Returns the validation result.
|
public
|
#
find_record_id( array $service )
Get the record id of an existing record.
Get the record id of an existing record.
NOTICE! The record must exist, otherwise an exeption will be raised.
Parameters
- $service
array $service Contains the service record data. Name, duration and price values are
mandatory for this method to complete.
|
public
boolean
|
#
delete( numeric $service_id )
Delete a service record from database.
Delete a service record from database.
Parameters
- $service_id
numeric $service_id Record id to be deleted.
Returns
boolean Returns the delete operation result.
|
public
array
|
#
get_row( numeric $service_id )
Get a specific row from the services db table.
Get a specific row from the services db table.
Parameters
- $service_id
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.
|
public
string
|
#
get_value( string $field_name, integer $service_id )
Get a specific field value from the database.
Get a specific field value from the database.
Parameters
- $field_name
string $field_name The field name of the value to be returned.
- $service_id
integer $service_id The selected record's id.
Returns
string Returns the records value from the database.
|
public
array
|
#
get_batch( string $where_clause = NULL )
Get all, or specific records from service's table.
Get all, or specific records from service's table.
Parameters
- $where_clause
string $whereClause (OPTIONAL) The WHERE clause of the query to be executed. DO NOT
INCLUDE 'WHERE' KEYWORD.
Returns
array Returns the rows from the database.
Example
$this->Model->getBatch('id = ' . $recordId);
|
public
array
|
#
get_available_services( )
This method returns all the services from the database.
This method returns all the services from the database.
Returns
array Returns an object array with all the database services.
|
public
integer
|
#
add_category( array $category )
Add (insert or update) a service category record into database.
Add (insert or update) a service category record into database.
Parameters
- $category
array $category Containst the service category data.
Returns
integer Returns the record id.s
|
public
boolean
|
#
delete_category( numeric $category_id )
Delete a service category record from the database.
Delete a service category record from the database.
Parameters
- $category_id
numeric $category_id Record id to be deleted.
Returns
boolean Returns the delete operation result.
|
public
array
|
#
get_category( numeric $category_id )
Get a service category record data.
Get a service category record data.
Parameters
- $category_id
numeric $category_id Record id to be retrieved.
Returns
array Returns the record data from the database.
|
public
array
|
#
get_all_categories( mixed $where = '' )
Get all service category records from database.
Get all service category records from database.
Returns
array Returns an array that contains all the service category records.
|
public
boolean
|
#
validate_category( array $category )
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.
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
- $category
array $category Contains the service category data.
Returns
boolean Returns the validation result.
|