Upon further testing, I've run into an unfortunate snag. 
Earlier I had a list of alternative ways to call my RegisterReference function:
PHP Code:
// Alternatives
$Some->RegisterReference('SomeOtherClass');
$Some->RegisterReference('/path/file.php:SomeOtherClass');
$Some->RegisterReference(new SomeOtherClass());
It turns out that this cannot work based on my definition of RegisterReference:
PHP Code:
function registerReference(&$Ref) {
$this->Ref =& $Ref;
}
Since the RegisterReference takes has a reference parameter, you cannot pass a constant value to this function.
It seems that I am forced to choose between taking a constant and loosing the ability to pass an already instantiated object (or Proxy Object) OR taking only an object and loosing the simplicity of being able to pass in a class name as a string. (which has some backward compatibillity issues for my purposes.)
Here is an example of how I wanted to use this capability in WACT:
PHP Code:
require '../configure.inc.php';
require_once WACT_ROOT . '/controller/formpage.inc.php';
define('LOCAL_PATH', dirname(__FILE__));
$Form = new FormPage();
$Form->registerView(LOCAL_PATH . '/formview.inc.php:CategoryFormView');
$Form->registerValidator(LOCAL_PATH . '/validator.inc.php:CategoryValidator');
$Form->registerSubmitAction('preview', WACT_ROOT . '/controller/noaction.inc.php:NoAction');
$Form->registerSubmitAction('add', LOCAL_PATH . '/add.inc.php:AddCategory', PRE_VALID);
$Form->registerDefaultSubmitAction(LOCAL_PATH . '/add.inc.php:AddCategory', PRE_VALID);
$Form->Run();
I also wanted to be able to support something like this alternative usage of the same thing (or the ability to mix and match from either style):
PHP Code:
require '../configure.inc.php';
require_once WACT_ROOT . '/controller/formpage.inc.php';
require 'formview.inc.php';
require 'validator.inc.php';
require 'add.inc.php';
require WACT_ROOT . '/controller/noaction.inc.php';
$Form = new FormPage();
$Form->registerView(new CategoryFormView());
$Form->registerValidator(new CategoryValidator());
$Form->registerSubmitAction('preview', new NoAction());
$Form->registerSubmitAction('add',new AddCategory(), PRE_VALID);
$Form->registerDefaultSubmitAction(new AddCategory(), PRE_VALID);
$Form->Run();
However, it seems that I can only have one or the other because of the reference parameter on the register functions. I don't like to remove the reference because then any objects that get passed in will get cloned, potentially leading to subtle bugs. I would almost rather remove the capability to pass in objects altogether.
Bookmarks