02-24-2010, 07:56 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: May 2009
Posts: 178
Thanks: 9
|
Issue handling object types
I'm using an MVC framework i've created but cant seem to get the following class to instantiate as it errors saying the objevt being passed is not of the correct type. Any ideas what is going wrong?
Here's the calling function from a registry class:
PHP Code:
static function appController($map) {
if ($map instanceof ControllerMap) {print "controllermap2";}
if (! isset(self::$appController)) {
print "new app controller";
self::$appController = new appController($map);
}
return self::$appController;
}
Here's the relevant part of the accepting class:
PHP Code:
class AppController {
private static $base_cmd;
private static $default_cmd;
private $controllerMap;
private $invoked = array();
public function __construct(ContollerMap $map) {
$this->controllerMap = $map;
if (! self::$base_cmd) {
self::$base_cmd = new RelflectionClass("Command");
self::$default_cmd = new DefaultCommand();
}
}
Here's the error i get:
Quote:
|
Catchable fatal error: Argument 1 passed to AppController::__construct() must be an instance of ContollerMap, instance of ControllerMap given, called in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\framework2\framework.c lasses\Registry.class.php on line 132 and defined in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\framework2\framework.c lasses\AppController.class.php on line 9
|
The print statements are just to confirm I am passing through the parts of the code i think I am.
|
|
|
|