Statement Helper Functions
The helper you can use to create, delete, get and update Statement details.
Filter name: before_add_statement
Description: This filter would be executed before add statement into the database in add_statement helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_add_statement’, ‘before_add_statement_callback_fun’, 10, 1 );
function before_add_statement_callback_fun($statement) {
// code
}
Filter name: should_add_statement
Description: This filter would be executed before add statement into database in add_statement helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_add_statement’, ‘should_add_statement_callback_fun’, 10, 1 );
function should_add_statement_callback_fun($statement) {
// code
}
hook name: pre.add.statement
Description: This hook would be executed before add statement into the database in add_statement helper.
Usage:
// The filter callback function is based on the filter.
add_action('pre.add.statement', 'pre_add_statement_callback_fun', 10, 1);
function pre_add_statement_callback_fun($statement) {
// code
}
hook name: post.add.statement
Description: This hook would be executed after add statement into the database in add_statement helper.
Usage:
// The filter callback function is based on the filter.
add_action('post.add.statement', 'post_add_statement_callback_fun', 10, 1);
function post_add_statement_callback_fun($statement) {
// code
}
Usage
// for use statement helper you need to add this helper on controller or
// you can autoload this helper.
$this->load->helper('includes/statement');
// add a new statement in statement table.
$statement_id = add_statement($statement);
Request Parameters
Parameters in array format includes following attributes:
Param | Type | Required | Default | Description |
---|---|---|---|---|
statement_number | Integer | Yes | Null | The statement_number of a specific statement. |
creation_date | Date_time | | Null | the creation_date for specific statement ( must provide date in gmdate() format) |
statement_name | Character | Yes | Null | The statement_name for specific statement. |
booking_id | Integer | Yes | Null | The booking_id create for a specific booking statement. |
Response
Response includes the following attributes:
if data have been added successfully it would return the key of specific statement id.
return $statement_id;
if data does not add it will return null.
Filter name: before_get_statement
Description: This filter would be executed before retrieving statement details from database in get_statement helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_get_statement’, ‘before_get_statement_callback_fun’, 10, 1 );
function before_get_statement_callback_fun($statement_id) {
// code
}
Filter name: should_get_statement
Description: This filter would be executed before retrieving statement details from database in get_statement helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_get_statement’, ‘should_get_statement_callback_fun’, 10, 1 );
function should_get_statement_callback_fun($statement_id) {
// code
}
hook name: pre.get.statement
Description: This hook would be executed before retrieving statement details from database in get_statement helper.
Usage:
// The filter callback function is based on the filter.
add_action('pre.get.statement', 'pre_get_statement_callback_fun', 10, 1);
function pre_get_statement_callback_fun($statement_id) {
// code
}
hook name: post.get.statement
Description: This hook would be executed after retrieving statement details from database in get_statement helper.
Usage:
// The filter callback function is based on the filter.
add_action('post.get.statement', 'post_get_statement_callback_fun', 10, 1);
function post_get_statement_callback_fun($statement_id) {
// code
}
Usage
// Retrieves statementdata based on a statement_id.
$statement_data = get_statement($statement_id);
Request Parameters
Param | Type | Required | Default | Description |
---|---|---|---|---|
$statement_id | Integer | Yes | Null | The id of the statement corresponds to the statement table |
Response
// $response array includes following attributes:
// $response['statement_number'] : the statement_number of specific statement.
// $response['creation_date'] : the creation_date for specific statement .
// $response['statement_name'] : the statement_name for specific statement.
// $response['booking_id'] : the booking_id for specific statement.
// and many more attributes for table statement and join with booking_x_statement table.
// Successfully response giving you array of statement data.
Array
(
[0] => Array
(
[statement_id] => 1
[statement_number] => 0
[is_deleted] => 0
[creation_date] => 2022-01-24 05:58:43
[statement_name] => booking create
[booking_id] => 1
)
)
// If there is no statement data for any statement id provided in input or any error will return null.
Supported hooks
Filter name: before_get_statements
Description: This filter would be executed before retrieving statement details from database in get_statements helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_get_statements’, ‘before_get_statements_callback_fun’, 10, 1 );
function before_get_statements_callback_fun($filter) {
// code
}
Filter name: should_get_statements
Description: This filter would be executed before retrieving statement details from database in get_statements helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_get_statements’, ‘should_get_statements_callback_fun’, 10, 1 );
function should_get_statements_callback_fun($filter) {
// code
}
hook name: pre.get.statements
Description: This hook would be executed before retrieving statement details from database in get_statements helper.
Usage:
// The filter callback function is based on the filter.
add_action('pre.get.statements', 'pre_get_statements_callback_fun', 10, 1);
function pre_get_statements_callback_fun($filter) {
// code
}
hook name: post.get.statements
Description: This hook would be executed after retrieving statement details from database in get_statements helper.
Usage:
// The filter callback function is based on the filter.
add_action('post.get.statements', 'post_get_statements_callback_fun', 10, 1);
function post_get_statements_callback_fun($filter) {
// code
}
Usage
// Retrieves statement data based on a filter array.
$statement_data = get_statements($filter);
Request Parameters
parameter array filter required for statement details.
Param | Type | Required | Default | Description |
---|---|---|---|---|
statement_name | Character | Yes | Null | The statement_name for a specific statement. |
booking_id | Integer | Yes | Null | The booking_id for specific statement. |
Response
// $response array includes following attributes:
// $response['statement_number'] : the statement_number of specific statement.
// $response['creation_date'] : the creation_date for specific statement .
// $response['statement_name'] : the statement_name for specific statement.
// $response['booking_id'] : the booking_id for specific statement.
// and many more attributes for table statement and join with booking_x_statement table.
// Successfully response giving you array of statement data.
Array
(
[0] => Array
(
[statement_id] => 1
[statement_number] => 0
[is_deleted] => 0
[creation_date] => 2022-01-24 05:58:43
[statement_name] => booking create must need
[booking_id] => 1
)
)
// If there is no statement data for filter provided in input or any error will return null.
Usage
// update statement data based on a statement array data and statement_id.
update_statement($statement, $statement_id);
Supported hooks
Filter name: before_update_statement
Description: This filter would be executed before update statement into the database in update_statement helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘before_update_statement’, ‘before_update_statement_callback_fun’, 10, 1 );
function before_update_statement_callback_fun($statement, $statement_id) {
// code
}
Filter name: should_update_statement
Description: This filter would be executed before update tax into database in update_statement helper.
Usage:
// The filter callback function is based on the filter.
add_filter( ‘should_update_statement’, ‘should_update_statement_callback_fun’, 10, 1 );
function should_update_statement_callback_fun($statement, $statement_id) {
// code
}
hook name: pre.update.statement
Description: This hook would be executed before update statement into the database in update_statement helper.
Usage:
// The filter callback function is based on the filter.
add_action('pre.update.statement', 'pre_update_statement_callback_fun', 10, 1);
function pre_update_statement_callback_fun($statement, $statement_id) {
// code
}
hook name: post.update.statement
Description: This hook would be executed after update statement into the database in update_statement helper.
Usage:
// The filter callback function is based on the filter.
add_action('post.update.statement', 'post_update_statement_callback_fun', 10, 1);
function post_update_statement_callback_fun($statement, $statement_id) {
// code
}
Request Parameters
Request required statement_id and array format data includes following attributes:
Param | Type | Required | Default | Description | Text |
---|---|---|---|---|---|
statement_number | Integer | Yes | Null | The statement_number of a specific statement. | |
creation_date | Date_time | | Null | the creation_date for specific statement ( must provide date in gmdate() format) | |
statement_name | Character | Yes | Null | The statement_name for specific statement. | |
booking_id | Integer | Yes | Null | The booking_id create for a specific booking statement. | |
Response
Response return mixed Either true or null if statement data is updated then true else null.
Usage
// delete a statement data from the statement table. it's a soft delete process only status will change data still existing in the backend database.
delete_statement($statement_id);
Request Parameters
Param | Type | Required | Default | Description |
---|---|---|---|---|
$statement _id | integer | yes | null | The id of the statement corresponds to the statement table |
Response
Response return mixed Either true or null if statement data is deleted then true
else null.
Last modified 1yr ago