The WebAbility® Network Developers - Documentation
WebAbility Site
\core\WABase reference

I. Structure:


- namespace:
\core\

- Direct superclass:
\patterns\Singleton

- Direct known subclasses:
none

II. Description:


The 'base' object is a global system-wide singleton, used generally to store database connectors, configurations, user connection and security and so.
The 'base' object is set both as a static property and a local attribute in every object extended from \core\WAObject.

This means you can access the base object in every method just with a:
$this->base->[attribute]; or $this->base->[method]();

By its nature of a singleton, you can only create ONE class and instance of \core\WABase, system-wide.
The \core\WABase class insert itself automatically as the base object of \core\WAObject.


Example:



class myBase extends \core\WABase
{
public $config;

function __construct($config)
{
parent::__construct();
$this->config = $config;
}
}

// creating an instance of myBase (extending \core\WABase) it will install automatically into static global base of \core\WAObject)
new myBase(array('config' => 'my config parameters'));

... Lots of your code ...

class myClass extends \core\WAClass
{
function __construct()
{
parent::__construct();

// get the system-wide configuration
$config = $this->base->config;
}
}





III. Reference:


3.1. Contructor:


\core\WABase()
Creates the unique instance and insert it into the WAObject static base

3.2. Constants:

There is no constant into this class.


3.3. Attributes:

There is no attribute into this class.


3.4. Methods:

There is no method into this class.