Jump to content

Recommended Posts

Hi,

I am trying to use my controller. When I put the path "http://budgetobjects/index.php" I get what I'm supposed to get. When I put http://budgetobjects/companyInfo, I get a  Message: Invalid controller class ("CompanyinfoController").

 

I have the following class described in the CompanyInfoController.php file.

<?php
// application/controllers/CompanyinfoController.php
class default_CompanyInfoController extends Zend_Controller_Action 
{
    public function indexAction()
    {
        $companyInfo = new Default_companiesInformation();
        $this->view->entries = $companyInfo->fetchAll();
    }
}

 

Can anyone tell me what is wrong with my code?

 

Thanks,

JR

 

Link to comment
https://forums.phpfreaks.com/topic/160569-invalid-controller-class/
Share on other sites

I have told my bootstrap to use the default namespace

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initDoctype()
    {
       $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->doctype('XHTML1_STRICT');
    }

    protected function _initAutoload()
    {
        $autoloader = new Zend_Application_Module_Autoloader(array(
            'namespace' => 'Default_',
            'basePath'  => dirname(__FILE__),
        ));
        return $autoloader;
    }


}

 

this is my application.ini file ( I am in the development environment)

[production]
[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook-testing.db"

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/default/Controllers"
resources.layout.layoutPath = APPLICATION_PATH "/default/layouts/scripts"
resources.view[] = 

 

and this is my tree structure. I remove all the cases in the class name, even in the file name. I still get the error.

the error i get is the following:

Exception information:

 

Message: Invalid controller class ("CompanyinfoController")

Stack trace:

 

#0 /Library/WebServer/Documents/Zend/library/Zend/Controller/Dispatcher/Standard.php(255): Zend_Controller_Dispatcher_Standard->loadClass('CompanyinfoCont...')

#1 /Library/WebServer/Documents/Zend/library/Zend/Controller/Front.php(936): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

#2 /Library/WebServer/Documents/Zend/library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front->dispatch()

#3 /Library/WebServer/Documents/Zend/library/Zend/Application.php(303): Zend_Application_Bootstrap_Bootstrap->run()

#4 /Library/WebServer/Documents/budgetObjects/public/index.php(26): Zend_Application->run()

#5 {main}

 

 

Request Parameters:

 

array(3) {

  ["controller"]=>

  string(11) "companyinfo"

  ["action"]=>

  string(5) "index"

  ["module"]=>

  string(7) "default"

}

 

Do you notice that loadclass statement? It seems to still be looking for a CompanyinfoCon.. instead of companyinfo...

 

Here is my tree structure.

|____.DS_Store
|____.zfproject.xml
|____application
| |____.DS_Store
| |____Bootstrap.php
| |____configs
| | |____application.ini
| |____default
| | |____.DS_Store
| | |____controllers
| | | |____companyinfoController.php
| | | |____ErrorController.php
| | | |____IndexController.php
| | |____layouts
| | | |____.DS_Store
| | | |____scripts
| | | | |____layout.phtml
| | |____models
| | | |____.DS_Store
| | | |____companiesInformation.php
| | | |____companiesInformationMapper.php
| | | |____DBTable
| | | | |____companies_information.php
| | |____views
| | | |____.DS_Store
| | | |____helpers
| | | |____scripts
| | | | |____.DS_Store
| | | | |____companyinfo
| | | | | |____index.phtml
| | | | |____error
| | | | | |____error.phtml
| | | | |____index
| | | | | |____index.phtml
|____index.php
|____js
| |____test.js
|____library
| |____zend
|____public
| |____.htaccess
| |____bkp simpleindex.php
| |____index.php
|____tests
| |____application
| | |____bootstrap.php
| | |____controllers
| | | |____CompanyInfoControllerTest.php
| |____library
| | |____bootstrap.php
| |____phpunit.xml

 

Thanks for any help

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.