CakePHP 1.3 "Missing Controller" error - Controller Exists

I am having a problem with my CakePHP 1.3 app, and I'm not sure if it's a code issue or a DB issue.

I have a pretty simple function in one of my controllers, and whenever I add a query portion to that controller, I get the following (infuriating and completely unhelpful) error message:

Missing Controller
Error: InternalError.htmlController could not be found.

Error: Create the class InternalError.htmlController below in file: 
app/controllers/internal_error.html_controller.php

Here is the Model ForecastZones

class ForecastZone extends AppModel {
    var $name = 'ForecastZone';
    var $displayField = 'name';
    //The Associations below have been created with all possible keys, those that are not needed can be removed

    var $belongsTo = array(
        'State' => array(
            'className' => 'State',
            'foreignKey' => 'state_id',
            'conditions' => '',
            'fields' => '',
            'order' => ''
        )
    );

    var $hasMany = array(
        'ForecastZonePoly' => array(
            'className' => 'ForecastZonePoly',
            'foreignKey' => 'forecast_zone_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        )
    );

}

Here is the controller function that inexplicably fails:

    function poly($id = null) {
    if (!$id) {
        $this->Session->setFlash(__('Invalid forecast zone', true));
        $this->redirect(array('action' => 'index'));
    }
    $this->layout = false;

    $result = $this->ForecastZone->query("SELECT coords FROM forecast_zone_polies WHERE forecast_zone_id = $id;");
    $this->set('forecastZone', $result);
}

CakePHP epic fails whenever I call this controller action. It hangs for a LONG time... and then instead of telling me something useful like "database query took too long" or "model association broken" or something like that... it just gives up and gives me this complete BS error message.

This is not a path issue, the paths are correct. If I remove the $result variable, everything works fine and I get the appropriate "forecastZone is not set" error message. The crux of this issue seems to be a query that takes forever, and then Cake not properly reporting the error message.

Please help clear this up for me. Very frustrating... not "Cake" at all by any stretch of the word.

EDIT: I wanted to add that I originally had been using

$this->ForecastZone->read(null,$id);

To grab the data, but the hanging & failing of the query kept happening so I switched to the raw query in hopes that might change something.

EDIT 2:

More things I tried: Added this line to the top of my controller:

var $uses = array('ForecastZone','ForecastZonePolies');

And then tried to do things "the right way" that still fail. UGH!

$result = $this->ForecastZonePolies->find('all',array('conditions' => array('ForecastZonePolies.forecast_zone_id' => $id)));

$result = $this->ForecastZone->ForecastZonePolies->find('all',array('conditions' => array('ForecastZonePolies.forecast_zone_id' => $id)));

None of these work.

Answers


First I'd check app/tmp/logs/error.log and app/tmp/logs/debug.log. If this really is an internal error, you should get details there.

From the weird inflecting, I'd suggest you to put Router::parseExtensions('html') in your app/config/routes.php to make sure this isn't a redirect issue.


Need Your Help

How do you query the database within the model?

c# asp.net-mvc entity-framework

NOTE: This is an entire rewrite of the previous question.

Is possible to bind to express callback promise?

node.js express promise

Is possible to bind to express callback promise ?