Model::getInstance
Obtains an instance of one of Model's descendants.
Synopsis
uses('model');
public static function Model Model::getInstance(array [in,optional] $args = null)
Description
If $args['class'] is not set, Model::getInstance() will immediately
return null.
Otherwise, an instance of the named class will be obtained, and its
constructor will be invoked, passing $args.
Descendants should override Model::getInstance() to set $args['class'] to
the name of the class if it's not set.
Descendants should, if possible, ensure that $args['db'] is set to
a database connection URI which can be passed to DBCore::connect().
The combination of $args['class'] and $args['db'] are used to
construct a key into the shared instance list. When a new instance is
constructed, it is stored with this key in the list. If an entry with
the key is already present, it will be returned and no new instance
will be created.
Parameters
| Name | Direction | Type | Description |
|---|---|---|---|
$args
| in,optional | array | Initialisation parameter array. |
Return Value
On success, returns an instance of a descendant of Model.