__construct()
__construct()
Class Constructor
add(array $appointment) : integer
Add an appointment record to the database.
This method adds a new appointment to the database. If the appointment doesn't exists it is going to be inserted, otherwise the record is going to be updated.
array | $appointment | Associative array with the appointment data. Each key has the same name with the database fields. |
Returns the appointments id.
exists(array $appointment) : boolean
Check if a particular appointment record already exists.
This method checks wether the given appointment already exists in the database. It doesn't search with the id, but by using the following fields: "start_datetime", "end_datetime", "id_users_provider", "id_users_customer", "id_services".
array | $appointment | Associative array with the appointment's data. Each key has the same name with the database fields. |
Returns wether the record exists or not.
find_record_id(array $appointment) : integer
Find the database id of an appointment record.
The appointment data should include the following fields in order to get the unique id from the database: "start_datetime", "end_datetime", "id_users_provider", "id_users_customer", "id_services".
IMPORTANT! The record must already exists in the database, otherwise an exception is raised.
array | $appointment | Array with the appointment data. The keys of the array should have the same names as the db fields. |
Returns the db id of the record that matches the apppointment data.
get_row(\numeric $appointment_id) : array
Get a specific row from the appointments table.
\numeric | $appointment_id | The record's id to be returned. |
Returns an associative array with the selected record's data. Each key has the same name as the database field names.
get_value(string $field_name, \numeric $appointment_id) : string
Get a specific field value from the database.
string | $field_name | The field name of the value to be returned. |
\numeric | $appointment_id | The selected record's id. |
Returns the records value from the database.
get_batch(string $where_clause = '') : array
Get all, or specific records from appointment's table.
string | $where_clause | (OPTIONAL) The WHERE clause of the query to be executed. DO NOT INCLUDE 'WHERE' KEYWORD. |
Returns the rows from the database.
** File not found : $this->Model->getBatch('id **
generate_hash() : string
Generate a unique hash for the given appointment data.
This method uses the current date-time to generate a unique hash string that is later used to identify this appointment. Hash is needed when the email is send to the user with an edit link.
Returns the unique appointment hash.
update(array $appointment)
Update an existing appointment record in the database.
The appointment data argument should already include the record id in order to process the update operation.
array | $appointment | Associative array with the appointment's data. Each key has the same name with the database fields. |