\Customers_Model

Summary

Methods
Properties
Constants
__construct()
add()
exists()
find_record_id()
validate()
delete()
get_row()
get_value()
get_batch()
get_customers_role_id()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
insert()
update()
No private properties found
N/A

Methods

__construct()

__construct() 

Class Constructor

add()

add(array  $customer) : integer

Add a customer record to the database.

This method adds a customer to the database. If the customer doesn't exists it is going to be inserted, otherwise the record is going to be updated.

Parameters

array $customer

Associative array with the customer's data. Each key has the same name with the database fields.

Returns

integer —

Returns the customer id.

exists()

exists(array  $customer) : boolean

Check if a particular customer record already exists.

This method checks wether the given customer already exists in the database. It doesn't search with the id, but with the following fields: "email"

Parameters

array $customer

Associative array with the customer's data. Each key has the same name with the database fields.

Returns

boolean —

Returns wether the record exists or not.

find_record_id()

find_record_id(array  $customer) : integer

Find the database id of a customer record.

The customer data should include the following fields in order to get the unique id from the database: "email"

IMPORTANT! The record must already exists in the database, otherwise an exception is raised.

Parameters

array $customer

Array with the customer data. The keys of the array should have the same names as the db fields.

Returns

integer —

Returns the id.

validate()

validate(array  $customer) : boolean

Validate customer data before the insert or update operation is executed.

Parameters

array $customer

Contains the customer data.

Returns

boolean —

Returns the validation result.

delete()

delete(\numeric  $customer_id) : boolean

Delete an existing customer record from the database.

Parameters

\numeric $customer_id

The record id to be deleted.

Returns

boolean —

Returns the delete operation result.

get_row()

get_row(\numeric  $customer_id) : array

Get a specific row from the appointments table.

Parameters

\numeric $customer_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  $customer_id) : string

Get a specific field value from the database.

Parameters

string $field_name

The field name of the value to be returned.

integer $customer_id

The selected record's id.

Returns

string —

Returns the records value from the database.

get_batch()

get_batch(  $where_clause = '') : array

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

Parameters

$where_clause

Returns

array —

Returns the rows from the database.

Examples

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

get_customers_role_id()

get_customers_role_id() : integer

Get the customers role id from the database.

Returns

integer —

Returns the role id for the customer records.

insert()

insert(array  $customer) : integer

Insert a new customer record to the database.

Parameters

array $customer

Associative array with the customer's data. Each key has the same name with the database fields.

Returns

integer —

Returns the id of the new record.

update()

update(array  $customer) : integer

Update an existing customer record in the database.

The customer data argument should already include the record id in order to process the update operation.

Parameters

array $customer

Associative array with the customer's data. Each key has the same name with the database fields.

Returns

integer —

Returns the updated record id.