org-puremvc-php-multicore
[ class tree: org-puremvc-php-multicore ] [ index: org-puremvc-php-multicore ] [ all elements ]

Class: Model

Source Location: /org/puremvc/php/multicore/core/Model.php

Class Overview


A Multiton IModel implementation.


Author(s):

Implements interfaces:

Variables

Constants

Methods



Class Details

[line 49]
A Multiton IModel implementation.

In PureMVC, the Model class provides access to model objects (Proxies) by named lookup.

The Model assumes these responsibilities:

  • Maintain a cache of IProxy instances.
  • Provide methods for registering, retrieving, and removing IProxy instances.
Your application must register IProxy instances with the Model. Typically, you use an ICommand to create and register IProxy instances once the Facade has initialized the Core actors.




Tags:

see:  IProxy
see:  Proxy


[ Top ]


Class Variables

static $instanceMap = array()

[line 73]

The Multiton instances stack



Tags:

access:  protected

Type:   array


[ Top ]

$multitonKey =

[line 67]

The Multiton Key for this Core



Tags:

access:  protected

Type:   string


[ Top ]

$proxyMap = array()

[line 61]

Mapping of proxyNames to IProxy references



Tags:

access:  protected

Type:   array


[ Top ]



Class Methods


static method getInstance [line 125]

static IModel getInstance( string $key)

Model Factory method.

This IModel implementation is a Multiton so this method MUST be used to get acces, or create, IModels.




Tags:

return:  The instance for this Multiton key
access:  public


Parameters:

string   $key   Unique key for this instance.

[ Top ]

static method removeModel [line 203]

static void removeModel( string $key)

Remove Model

Remove an IModel instance by key.




Tags:

access:  public


Parameters:

string   $key   The multitonKey of IModel instance to remove

[ Top ]

constructor __construct [line 91]

IModel __construct( string $key)

Instance constructor

This IModel implementation is a Multiton, so you should not call the constructor directly, but instead call the static Multiton Factory method.

ex:

  1.  Model::getInstance'multitonKey' )




Tags:

return:  Multiton instance for this key
throws:  Exception if instance for this key has already been constructed
access:  protected


Parameters:

string   $key   Unique key for this instance.

[ Top ]

method hasProxy [line 171]

bool hasProxy( string $proxyName)

Has Proxy

Check if a Proxy is registered for the given proxyName.




Tags:

return:  Whether a Proxy is currently registered with the given proxyName.
access:  public



Implementation of:
IModel::hasProxy()
Has Proxy

Parameters:

string   $proxyName   Name of the Proxy to check for.

[ Top ]

method initializeModel [line 112]

void initializeModel( )

Initialize the Model instance.

Called automatically by the constructor, this is your opportunity to initialize the instance in your subclass without overriding the constructor.




Tags:

access:  protected


[ Top ]

method registerProxy [line 143]

void registerProxy( IProxy $proxy)

Register Proxy

Register an IProxy with the Model.




Tags:

access:  public



Implementation of:
IModel::registerProxy()
Register Proxy

Parameters:

IProxy   $proxy   The IProxy to be registered with the Model.

[ Top ]

method removeProxy [line 184]

IProxy removeProxy( string $proxyName)

Remove Proxy

Remove a previously registered IProxy instance from the Model by name.




Tags:

return:  The IProxy that was removed from the Model.
access:  public



Implementation of:
IModel::removeProxy()
Remove Proxy

Parameters:

string   $proxyName   Name of the IProxy to remove from the Model.

[ Top ]

method retrieveProxy [line 158]

IProxy retrieveProxy( string $proxyName)

Retreive Proxy

Retrieve a previously registered IProxy from the Model by name.




Tags:

return:  The IProxy previously regisetered by proxyName with the Model.
access:  public



Implementation of:
IModel::retrieveProxy()
Retreive Proxy

Parameters:

string   $proxyName   Name of the IProxy instance to be retrieved.

[ Top ]


Class Constants

MULTITON_MSG =  "Model instance for this Multiton key already constructed!"

[line 55]

Define the message content for the duplicate instance exception


[ Top ]



Documentation generated on Mon, 03 Aug 2009 04:58:00 +0000 by phpDocumentor 1.4.2