Init() method used to register Hooks to get access of a particular resource. See below example
class Component_ComponentName_Register extends appRain_Base_Component
{
public function init()
{
}
}
Note: System execute all Init event on the time of resource allocation only for the active components.
See below example that register a controller:
class Component_Appstore_Register extends appRain_Base_Component
{
public function init()
{
App::Module('Hook')
->setHookName('Controller')
->setAction("register_controller")
->Register(get_class($this),"register_controller");
}
public function register_controller()
{
$srcpaths = Array();
$srcpaths[] = array(
'name'=>'appStore',
'controller_path'=>$this->attachMyPath('controllers')
);
return $srcpaths;
}
}