title: Exception information: Message: No adapter found for Model_Bug
body: <p>I'll be honest, Zend is giving me a lot of headaches at the moment, but I guess we all have to start somewhere and I'm learning fast. </p>
  
  <p>I am using the Apress book 'Pro Zend Framework Techniques' to learn how to use Zend, but hit and error last night which I couldn't solve.  Having Googled around and slept on it for a night I'm still getting nowhere.  Here's the error:</p>
  
  <pre><code>An error occurred
  Application error
  Exception information:
  Message: No adapter found for Model_Bug
  Stack trace:
  #0 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Db/Table/Abstract.php(739): Zend_Db_Table_Abstract-&gt;_setupDatabaseAdapter()
  #1 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Db/Table/Abstract.php(268): Zend_Db_Table_Abstract-&gt;_setup()
  #2 /home/www-data/zend.danielgroves.net/htdocs/application/controllers/BugController.php(29): Zend_Db_Table_Abstract-&gt;__construct()
  #3 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Action.php(516): BugController-&gt;submitAction()
  #4 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action-&gt;dispatch('submitAction')
  #5 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
  #6 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front-&gt;dispatch()
  #7 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap-&gt;run()
  #8 /home/www-data/zend.danielgroves.net/htdocs/public/index.php(26): Zend_Application-&gt;run()
  #9 {main}  
  Request Parameters:
  array (
    'controller' =&gt; 'bug',
    'action' =&gt; 'submit',
    'module' =&gt; 'default',
    'author' =&gt; 'Daniel',
    'email' =&gt; 'someemail@googlemail.com',
    'date' =&gt; '12-12-2012',
    'url' =&gt; 'sadflj.asd.sd',
    'description' =&gt; 'sdfoi',
    'priority' =&gt; 'low',
    'status' =&gt; 'new',
    'submit' =&gt; 'Submit',
  )  
  </code></pre>
  
  <p>Generally speaking, whats the cause of this error?  How do I need to go about solving it?</p>
  
  <p>Relevant files are below, if anymore information is required shout and I'll post it.  </p>
  
  <p>My application.ini file:</p>
  
  <pre><code>[production]
  phpSettings.display_startup_errors = 0
  phpSettings.display_errors = 0
  includePaths.library = APPLICATION_PATH "/../library"
  bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
  bootstrap.class = "Bootstrap"
  appnamespace = "Application"
  resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
  resources.frontController.params.displayExceptions = 0
  
  resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
  
  recources.db.adapter = "Pdo_Mysql"
  resources.db.params.host = "localhost"
  resources.db.params.username = ""
  resources.db.params.password = ""
  resources.db.params.dbname = "zf_cms"
  resoucres.db.isDefaultTableAdapter = true
  
  [staging : production]
  
  [testing : production]
  phpSettings.display_startup_errors = 1
  phpSettings.display_errors = 1
  
  [development : production]
  phpSettings.display_startup_errors = 1
  phpSettings.display_errors = 1
  resources.frontController.params.displayExceptions = 1
  </code></pre>
  
  <p>Bootstrap:</p>
  
  <pre><code>&lt;?php
  
  class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
  {
      protected function _initView()
      {
          // Initialise view
          $view = new Zend_View();
          $view-&gt;doctype('XHTML1_STRICT');
          $view-&gt;headTitle('Zend CMS');
          $view-&gt;skin = 'blues';
  
          // Add it to the ViewRenderer
          $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
              'ViewRenderer'
          );
          $viewRenderer-&gt;setView($view);
  
          // Return it, so that it can be stored by the bootstrap
          return $view;
      }
  
      protected function _initAutoload()
      {
          // Add autoloader empty namespace
          $autoLoader = Zend_Loader_Autoloader::getInstance();
          $autoLoader-&gt;registerNamespace('CMS_');
          $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
              'basePath'      =&gt; APPLICATION_PATH,
              'namespace'     =&gt; '',
              'resourceTypes' =&gt; array(
                  'form'      =&gt; array(
                      'path'      =&gt; 'forms/',
                      'namespace' =&gt; 'Form_',
                  ),
                  'model'     =&gt; array(
                      'path'      =&gt; 'models/',
                      'namespace' =&gt; 'Model_'
                  ),
              ),
          ));
  
          //Return it so that it can be stored by the bootstrap
          return $autoLoader;
      }
  }
  </code></pre>
  
  <p>Bug Model:</p>
  
  <pre><code>&lt;?php
  
  class Model_Bug extends Zend_Db_Table_Abstract
  {
      protected $_name = 'bugs';
  
      public function createBug($name, $email, $date, $url, $description, $priority, $status)
      {
          $row = $this-&gt;createRow();
  
          // Set the row data
          $row-&gt;author        = $name;
          $row-&gt;email         = $email;
          $dateObject         = new Zend_Date($date);
          $row-&gt;date          = $dateObject-&gt;get(Zend_Date::TIMESTAMP);
          $row-&gt;url           = $url;
          $row-&gt;description   = $description;
          $row-&gt;priority      = $priority;
          $row-&gt;status        = $status;
  
          // save the new row
          $row-&gt;save();
  
          // now fetch the id of the row you just created and return it
          $id = $this-&gt;_db-&gt;lastInsertId();
          return $id;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Bug Controller:
      
  
  <pre><code>class BugController extends Zend_Controller_Action
  {
  
      public function init()
      {
          /* Initialize action controller here */
      }
  
      public function indexAction()
      {
          // action body
      }
  
      public function createAction()
      {
          // action body
      }
  
      public function submitAction()
      {
          $bugReportForm = new Form_BugReportForm();
          $bugReportForm-&gt;setAction('/bug/submit');
          $bugReportForm-&gt;setMethod('post');
  
          if ($this-&gt;getRequest()-&gt;isPost()) {
              if ($bugReportForm-&gt;isValid($_POST)) {
                  $bugModel = new Model_Bug();
  
                  // if the form is valid then create the new bug
                  $result = $bugModel-&gt;createBug(
                      $bugReportForm-&gt;getValue('author'),
                      $bugReportForm-&gt;getValue('email'),
                      $bugReportForm-&gt;getValue('date'),
                      $bugReportForm-&gt;getValue('url'),
                      $bugReportForm-&gt;getValue('description'),
                      $bugReportForm-&gt;getValue('priority'),
                      $bugReportForm-&gt;getValue('status')
                  );
  
                  // if the createBug method returns a result
                  // then the bug was successfully created
  
                  if ($result)
                      $this-&gt;_foreward('confirm');
              }
          }
  
          $this-&gt;view-&gt;form = $bugReportForm;
      }
  
      public function confirmAction()
      {
          // action body
      }
  
  
  }
  </code></pre>