__construct()
__construct()
Class Constructor
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.
array | $customer | Associative array with the customer's data. Each key has the same name with the database fields. |
Returns the customer id.
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"
array | $customer | Associative array with the customer's data. Each key has the same name with the database fields. |
Returns wether the record exists or not.
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.
array | $customer | Array with the customer data. The keys of the array should have the same names as the db fields. |
Returns the id.
get_value(string $field_name, integer $customer_id) : string
Get a specific field value from the database.
string | $field_name | The field name of the value to be returned. |
integer | $customer_id | The selected record's id. |
Returns the records value from the database.
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.
array | $customer | Associative array with the customer's data. Each key has the same name with the database fields. |
Returns the updated record id.