Page 1 of 1

Zend Framework 0.9.1 - Another problem

Posted: Fri Mar 30, 2007 4:22 pm
by Hades
Ok... give the amount of trouble I've been having getting the Zend Framework going I decided to go back to basics.

I have the bootstrap index.php and .htaccess files from the ZF manual and two controllers... IndexController and LoginController.

Each controller action has a simple echo statement that outputs the controller name and action name.

The Indexcontroller works fine, but LoginController gives the correct output along with the following error...

Code: Select all

Fatal error: Call to a member function isDispatched() on a non-object in /home/editpc/hubdata/library/Zend/Controller/Action.php on line 486
I've done a google search about this but only found vague references to it and no usable leads.

Any help would be appreciated.

Posted: Fri Mar 30, 2007 4:44 pm
by Christopher
Can you post your index.php and the controller's code. If it is long then provide a link were we can download it. It would be helpful to actually run the code to find the problem.

Posted: Sat Mar 31, 2007 3:07 pm
by Hades
Sure... here you go...

Code: Select all

<?php
/**
 * Bootstrap file for HUB Application
 *
 * For ZF 0.9.1
 */

/*
 * The basics...
 */
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1); //disable on production servers!
date_default_timezone_set('Europe/London');

set_include_path('/home/editpc/hubdata/library');

require_once 'Zend/Controller/Front.php';

$controller = Zend_Controller_Front::run('/home/editpc/hubdata/application/controllers');
?>

Code: Select all

<?php
/**
 * HUB Application IndexController
 *
 * This is the indexController for the HUB Application.  It will handle all
 * requests to the main index of the application.
 *
 * @category   HUB
 * @package	controller
 * @copyright  Copyright (c) 2007 Lee Conlin
 */

class IndexController extends Zend_Controller_Action
{

	public function IndexAction()
	{
		echo 'IndexController::IndexAction';
	}


}
?>

Code: Select all

<?php
/**
 * HUB Application LoginController
 *
 * This is the LoginController for the HUB Application.  It will handle all
 * login and user management.
 *
 * @category   HUB
 * @package	controller
 * @copyright  Copyright (c) 2007 Lee Conlin
 */

class LoginController extends Zend_Controller_Action
{

	public function IndexAction()
	{
		echo 'LoginController::IndexAction';
	}

	public function LoginController(){
		echo 'LoginController::LoginAction';
	}
}
?>

Posted: Mon Apr 02, 2007 3:23 am
by AlexVN
The problem is here:

Code: Select all

class LoginController extends Zend_Controller_Action
{

        public function LoginController(){
                echo 'LoginController::LoginAction';
        }
}
Please rename LoginController method because it overwrites the default constructor.

Posted: Mon Apr 02, 2007 11:13 am
by Hades
Ok.. now I feel dumb. :oops:

That fixed it thanks. :)