Overview

The MY_Controller_Debug trait provides utility methods for debugging, error handling, and validation in CodeIgniter controllers. It includes functions for inserting error logs, checking method existence, and validating various aspects of the application.

Methods

insertError

Inserts an error message into the database and terminates the script execution.

This method inserts the error information into the error_log table and then terminates the script execution.

function_exists

Checks if a method exists in the current class.

return
boolean

Returns true if the method exists, false otherwise

methodExists

Checks if a method exists in a specified model and inserts an error if it doesn’t.

If the method doesn’t exist, it calls insertError and terminates the script.

functionExists

Checks if a function exists in the current class and inserts an error if it doesn’t.

If the function doesn’t exist, it calls insertError and terminates the script.

tableExists

Checks if a database table exists and inserts an error if it doesn’t.

If the table doesn’t exist, it calls insertError and terminates the script.

variableExists

Checks if a variable exists and is not false, null, or ‘undefined’, and inserts an error if it doesn’t meet these criteria.

If the variable doesn’t exist or is false, null, or ‘undefined’, it calls insertError and terminates the script.

postPropertiesExist

Checks if specified properties exist in the $_POST array and inserts an error if any are missing.