How does a Zend controller action have access to Form subclass for instantiation?

60 Views Asked by At

Considering this subclass of Zend_Form

class Form_Mine extends Zend_Form
{
    public function init()
     { 
        //form
      }    

Then in

Class MineController extends Zend_controller_Action
{
    public function formAction()
    {
      $form = new Form_Mine();
    }
}

How does the controller know of 'Form_Mine's existence in order to be instantiated?

I understand that through the Zend_Form's constructor the function init() is called setting up the form however through what chain or routing does the controller get access to 'Form_Mine'?

1

There are 1 best solutions below

0
Richard Snazell On

The class name is significant. By default, given a class named My_Form_Mine, Zend would look for the class in file: /library/My/Form/Mine.php. My understanding is that this is handled by the autoloader: http://framework.zend.com/manual/1.12/en/zend.loader.autoloader.html