Note that there are some explanatory texts on larger screens.

plurals
  1. POCakePHP 1.3 "Missing Controller" error - Controller Exists
    primarykey
    data
    text
    <p>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.</p> <p>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:</p> <pre><code>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 </code></pre> <p>Here is the Model ForecastZones</p> <pre><code>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' =&gt; array( 'className' =&gt; 'State', 'foreignKey' =&gt; 'state_id', 'conditions' =&gt; '', 'fields' =&gt; '', 'order' =&gt; '' ) ); var $hasMany = array( 'ForecastZonePoly' =&gt; array( 'className' =&gt; 'ForecastZonePoly', 'foreignKey' =&gt; 'forecast_zone_id', 'dependent' =&gt; false, 'conditions' =&gt; '', 'fields' =&gt; '', 'order' =&gt; '', 'limit' =&gt; '', 'offset' =&gt; '', 'exclusive' =&gt; '', 'finderQuery' =&gt; '', 'counterQuery' =&gt; '' ) ); } </code></pre> <p>Here is the controller function that inexplicably fails: </p> <pre><code> function poly($id = null) { if (!$id) { $this-&gt;Session-&gt;setFlash(__('Invalid forecast zone', true)); $this-&gt;redirect(array('action' =&gt; 'index')); } $this-&gt;layout = false; $result = $this-&gt;ForecastZone-&gt;query("SELECT coords FROM forecast_zone_polies WHERE forecast_zone_id = $id;"); $this-&gt;set('forecastZone', $result); } </code></pre> <p>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.</p> <p>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.</p> <p>Please help clear this up for me. Very frustrating... not "Cake" at all by any stretch of the word.</p> <p>EDIT: I wanted to add that I originally had been using </p> <pre><code>$this-&gt;ForecastZone-&gt;read(null,$id); </code></pre> <p>To grab the data, but the hanging &amp; failing of the query kept happening so I switched to the raw query in hopes that might change something.</p> <p>EDIT 2:</p> <p>More things I tried: Added this line to the top of my controller:</p> <pre><code>var $uses = array('ForecastZone','ForecastZonePolies'); </code></pre> <p>And then tried to do things "the right way" that still fail. UGH!</p> <pre><code>$result = $this-&gt;ForecastZonePolies-&gt;find('all',array('conditions' =&gt; array('ForecastZonePolies.forecast_zone_id' =&gt; $id))); $result = $this-&gt;ForecastZone-&gt;ForecastZonePolies-&gt;find('all',array('conditions' =&gt; array('ForecastZonePolies.forecast_zone_id' =&gt; $id))); </code></pre> <p>None of these work.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload