I am trying to figure out why isset doesn't works on $this variable? I am using HMVC codeigniter and trying to check if module loaded successfully:
$this->load->module('welcome');
var_dump(isset($this->welcome));
print_r($this->welcome);
Result is:
bool(false) --- This is the result of isset. Below is result of var_dump
Welcome Object
(
[autoload] => Array
(
)
[load] => MY_Loader Object
(
[_module:protected] => welcome
[_ci_plugins] => Array
(
)
[_ci_cached_vars] => Array
(
)
... some other protected variables
[controller] => Welcome Object
*RECURSION*
)
)
Why isset returns false?
After deep checking CodeIgniter core files, I figured out there is a way to check it:
if(!isset(Modules::$registry['welcome'])) { // check module loaded
return jsonError(2);
}
// module loaded. Go ahead