App factory is a pattern that organize all appRain resource and use to perform below tasks
One of the major task of App factory is to load class object in an optimize way. Most of the resource has a method to create object. See bellow examples:
Type |
Declaration |
Example |
---|---|---|
App::Model() |
App::Model('Admin') |
|
App::Helper() |
App::Helper('Utility') |
|
App::Module() |
App::Module('ACL') |
|
Plugin |
App::Plugin() |
App:Plugin('PhpMailer') |
App::InformationSet() |
App::InformationSet('EmailTemplate') |
|
App::CategorySet() |
App::CategorySet('blog-cat') |
App Factory apply Singleton pattern on resource allocation to avoid object reinitialization also it manage Cache in required place. See below common function of App factory.