title: Zend Framework 11.1: Form_Customer not found in
body: <p>First of all, I know there are a few quite similar questions here on stackoverflow about that form problem but none of them could actually help me so I'm giving it a try myself. I've been stuck with this for the past 10 hours and I'm really desesperate right now.</p>
  
  <p>So, let's start with my directory structure:</p>
  
  <pre><code>  gpos/
    ---- application/
         --- forms/
         ------- CustomerForm.php
         --- modules/
             --- default/
                 --- controllers/
                     --- CustomerController.php
                 --- views/
         --- Bootstrap.php
    ---- public/
    ---- library/
         --- Doctrine/
         --- GPos/
             --- Doctrine/
                 --- ActiveEntity.php
             --- Models/
                 --- Customer.php
  </code></pre>
  
  <p>As you can see, I'm using Zend's standard forms/ folder to store my forms and I'm also using Doctrine as DB manager.</p>
  
  <hr>
  
  <p>So I've been trying to reach my <code>CustomerForm.php</code> from <code>CustomerController.php</code> but simply getting a not found error.</p>
  
  <p>Here is the error I'm getting:<br>
  <code>Fatal error: Class 'Form_CustomerForm' not found in C:\wamp\www\GPos\gpos\application\modules\default\controllers\CustomerController.php on line 9</code></p>
  
  <p><code>CustomerController.php:</code></p>
  
  <pre><code>class CustomerController extends Zend_Controller_Action {
  
      public function init() {
          /* Initialize action controller here */
      }
  
      public function indexAction() {
          $form = new Form_CustomerForm(); //line 9
          $form-&gt;setAction('/customer/index');
          $form-&gt;setMethod('post');
          $this-&gt;view-&gt;form = $form;
      }
  </code></pre>
  
  <p>and <code>CustomerForm.php:</code>  </p>
  
  <pre><code>class Form_CustomerForm extends Zend_Form {
      public function init() {
  </code></pre>
  
  <p>and finally <code>views/scripts/customer/submit.phtml:</code></p>
  
  <pre><code>&lt;h2&gt;Customer&lt;/h2&gt;
  &lt;p&gt;To create blabla&lt;/p&gt;
  
  &lt;?php echo $this-&gt;form; ?&gt;
  </code></pre>
  
  <hr>
  
  <p>I've been desesperately trying to add Form namespace to the autoloader but I learned today that it was already in thanks to Zend doing it for us. So... What am I doing wrong? I found tons of posts saying how to add resources and how to manage custom forms and I feel I'm doing exactly what's asked but it just won't work not matter what.</p>
  
  <p>I'm afraid that it comes from somewhere else cause I've been trying to add different namespaces unsuccessfully too such as GPos_Doctrine for my ActiveEntity.php file in <code>library/GPos/Doctrine/</code> with:</p>
  
  <pre><code>protected function _initAutoload()
  {
      $autoloader = new Zend_Application_Module_Autoloader(array(
              'namespace' =&gt; 'Application',
              'basePath' =&gt; APPLICATION_PATH,
      ));
      $autoloader-&gt;addResourceType('gpos', '/../../library/GPos', 'GPos');
      $autoloader-&gt;addResourceType('doctrine', '/../../library/GPos/Doctrine', 'GPos_Doctrine');
  
      return $autoloader;
  }
  </code></pre>
  
  <p>This didn't work either. I'm quite unsure of the 'path' parameter (2nd param) but I saw in a tutorial that the path of eath resource type you add must be relative to autoloader's basePath, so I came up with these paths.</p>
  
  <p>The only way I could make my GPos_Doctrine_ActiveEntity() work was by adding <code>autoloadernamespaces[] = "GPos_"</code> to application.ini. Adding <code>autoloadernamespaces[] = "Form_"</code>didn't work though... I really don't understand what's wrong with my resource types I'm adding. </p>
  
  <p>Please note that I didn't use zf tools to build that project. I'm considering doing it if I don't find a way to make it all work correctly.</p>
  
  <p>I've also tried to rename my form class to "Application_Form_CustomerForm" but didn't do any good either. I feel I've tried everything I could now. I'm just deseperate :(</p>
  
  <p>Oh and by the way, the only work around I found at first is to put forms/ folder in my library, that worked. Don't understand why, but I don't want to use that hack. See, I'm doing this project as my IT Bachelor work graduation and I really shouldn't get into hacking things to make them work :P. </p>
  
  <p>Thank you for anybody paying attention!</p>