Class and Objects

Navigation:  Development > Architecture and Standard >

Class and Objects

Previous pageReturn to chapter overviewNext page

appRain environment always avoid to include a class manually, it load automatically when system required the object. For class loading it use auto load process that request to load the class during first instance creation.
 
Name Conversion:
Except some special class like Controller Model all class name create based on the path of the class. For example if we have a class file in development/helper/html.php  then class name must be Development_Helper_Html.

 

Basically this convention helps system to understand the class path.

 
Important:

Class name must not contain extra "_" except the directory separator.

Use camel case in class phase name like below

 

Correct Class

Incorrect Class

appRain_Base_Modules_Hook

apprain_base_modules_hook

appRain_Base_Objects

apprain_base_Objects_

 

Class file name:

Class php file must be lowercase. Mix case can create issues in some operation system like Unix. Follow below examples:
 

Correct File Name

Incorrect File Name

html.php

Html.php

member.php

MEMBER.php

appcommon_.php

appCommon_.php

 

Class Object Access

We always create Class object through App Factory. In most of the cases we use method to create object. In case you require to create a object then do it by App::__obj().