Please change Zend_Form constructor

1 message Options
Embed this post
Permalink
ZENDUSER60622

Please change Zend_Form constructor

Reply Threaded More More options
Print post
Permalink
I've spent the last few days tracking down a problem with my custom Form not rendering my custom Elements. I followed several tutorials that explained that I must use the addPrefixPath() function to let Zend_Form know about my custom elements.

However, I'm loading my form using Zend_Config and INI files through my own Zend_Form class extension. In the init() function of my custom Zend_Form class, I add my prefix paths. But unfortunately, elements from configs are added first in the constructor, then the init() function is called, which causes my custom elements to not be loaded.

code:

class My_Form extends Zend_Form {...}

$myForm = new My_Form(new Zend_Config_Ini('my_config.ini', 'testing'));

I don't think any elements should be loaded first through the constructor prior to calling the init() function. For the time being, I'm overloading the constructor and adding my prefix paths before processing the config, which works just fine.

I'm not completely new to Zend Framework, but I'm no expert. Does this make any sense?