public
|
|
public
integer
|
#
add( array $appointment )
Add an appointment record to the database.
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.
Parameters
- $appointment
Associative array with the appointment
data. Each key has the same name with the database fields.
Returns
integer Returns the appointments id.
|
public
boolean
|
#
exists( array $appointment )
Check if a particular appointment record already exists.
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".
Parameters
- $appointment
Associative array with the appointment's
data. Each key has the same name with the database fields.
Returns
boolean Returns wether the record exists or not.
|
public
integer
|
#
find_record_id( array $appointment )
Find the database id of an appointment record.
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.
Parameters
- $appointment
Array with the appointment data. The
keys of the array should have the same names as the db fields.
Returns
integer Returns the db id of the record that matches the apppointment
data.
|
public
boolean
|
#
validate( array $appointment )
Validate appointment data before the insert or update operations
are executed.
Validate appointment data before the insert or update operations
are executed.
Parameters
- $appointment
- Contains the appointment data.
Returns
boolean Returns the validation result.
|
public
boolean
|
#
delete( numeric $appointment_id )
Delete an existing appointment record from the database.
Delete an existing appointment record from the database.
Parameters
- $appointment_id
- The record id to be deleted.
Returns
boolean Returns the delete operation result.
Expectedexception
InvalidArgumentException Raises when the $appointment_id
is not an integer.
|
public
array
|
#
get_row( numeric $appointment_id )
Get a specific row from the appointments table.
Get a specific row from the appointments table.
Parameters
- $appointment_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, numeric $appointment_id )
Get a specific field value from the database.
Get a specific field value from the database.
Parameters
- $field_name
- The field name of the value to be returned.
- $appointment_id
- The selected record's id.
Returns
string Returns the records value from the database.
|
public
array
|
#
get_batch( string $where_clause = '' )
Get all, or specific records from appointment's table.
Get all, or specific records from appointment's table.
Parameters
- $where_clause
(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
string
|
#
generate_hash( )
Generate a unique hash for the given appointment data.
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
string Returns the unique appointment hash.
|
public
integer
|
#
add_unavailable( array $unavailable )
Inserts or updates an unavailable period record in the database.
Inserts or updates an unavailable period record in the database.
Parameters
- $unavailable
- Contains the unavaible data.
Returns
integer Returns the record id.
|
public
|
#
delete_unavailable( numeric $unavailable_id )
Delete an unavailable period.
Delete an unavailable period.
Parameters
- $unavailable_id
- Record id to be deleted.
|
public
|
#
clear_google_sync_ids( numeric $provider_id )
Clear google sync IDs from appointment record.
Clear google sync IDs from appointment record.
Parameters
- $provider_id
- The appointment provider record id.
|