TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 02-24-2010, 07:56 PM   #1 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default 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.
captainmerton is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the Clone Construct to Clone an Object Wildhoney Advanced PHP Programming 5 01-29-2013 11:51 AM
Using the factory pattern (mad rantings of a mind without coffee) sketchMedia Advanced PHP Programming 35 09-25-2009 11:05 AM
Handling Exceptions captainmerton Absolute Beginners 6 07-06-2009 07:10 PM
Object methods suddenly lagging? RobertK Advanced PHP Programming 9 01-11-2008 01:38 PM
Using Type Juggling/Type Casting to Modify Data Types Wildhoney Tips & Tricks 6 11-30-2007 02:44 AM


All times are GMT. The time now is 03:03 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design