Zend_Form: Directory for subclass'd forms?

4 messages Options
Embed this post
Permalink
jscherer26

Zend_Form: Directory for subclass'd forms?

Reply Threaded More More options
Print post
Permalink
I've decided to go the route of subclass of Zend_Form for my forms. Currently I'm storing them in the application/models/ directory but that doesn't seem right to me. I was prefixing them with formXXXXX.php. I didn't find anything in the documentation on this.

I understand that I could put it in .lib/MyLib/Form/ but I think of that for reusable forms that aren't application specific. For the most part my forms are going to be application specific, so I feel that they should be somewhere in the application/ structure.

Thanks in advance,

Jim
weierophinney

Re: Zend_Form: Directory for subclass'd forms?

Reply Threaded More More options
Print post
Permalink
-- Jim Scherer <[hidden email]> wrote
(on Monday, 03 March 2008, 11:54 AM -0800):
> I've decided to go the route of subclass of Zend_Form for my forms.

That's the route I recommend -- it's programmatic, and easier to debug
than configuration-based forms. Configuration-based forms are nice,
don't get me wrong, but my primary use case when developing the
component was always creating the forms programmatically.

> Currently I'm storing them in the application/models/ directory but
> that doesn't seem right to me. I was prefixing them with
> formXXXXX.php. I didn't find anything in the documentation on this.
>
> I understand that I could put it in .lib/MyLib/Form/ but I think of that for
> reusable forms that aren't application specific. For the most part my forms
> are going to be application specific, so I feel that they should be
> somewhere in the application/ structure.

It's not documented, as we haven't decided on a location for forms in
the directory hierarchy yet.

My predeliction would be in application/forms/, and prefix them with
'Form_'; in modules, they'd then be prefixed with '<Module>_Form_'.

--
Matthew Weier O'Phinney
PHP Developer            | [hidden email]
Zend - The PHP Company   | http://www.zend.com/
Amr Mostafa

Re: Zend_Form: Directory for subclass'd forms?

Reply Threaded More More options
Print post
Permalink
In reply to this post by jscherer26
That's what I do too. I store them in application/forms.
In library/ I have App_Form which extends Zend_Form. That allows me to setup default decorators, ...etc.

I like this approach very much so far, though with this approach, it seems easy to make some design mistakes. What I'm still trying to clearly understand, as decorators are essentially *view* stuff. Also, most of my forms know how to populate their fields that point to foreign keys. So that's mixing of *model* as well. Forms are becoming the mixin place, which I don't like. Am I violating 100 design rules and will be cursed to eternity?  What do you think?

Best,
- Amr

On Mon, Mar 3, 2008 at 9:54 PM, Jim Scherer <[hidden email]> wrote:

I've decided to go the route of subclass of Zend_Form for my forms. Currently
I'm storing them in the application/models/ directory but that doesn't seem
right to me. I was prefixing them with formXXXXX.php. I didn't find anything
in the documentation on this.

I understand that I could put it in .lib/MyLib/Form/ but I think of that for
reusable forms that aren't application specific. For the most part my forms
are going to be application specific, so I feel that they should be
somewhere in the application/ structure.

Thanks in advance,

Jim
--
View this message in context: http://www.nabble.com/Zend_Form%3A-Directory-for-subclass%27d-forms--tp15812272s16154p15812272.html
Sent from the Zend MVC mailing list archive at Nabble.com.


Karl Katzke

Re: Zend_Form: Directory for subclass'd forms?

Reply Threaded More More options
Print post
Permalink
Amr,

I actually regard the Forms to be part of the controller layer, which means that they're allowed to touch ... but not write .. both.

-K

On Mon, Mar 3, 2008 at 3:57 PM, Amr Mostafa <[hidden email]> wrote:
That's what I do too. I store them in application/forms.
In library/ I have App_Form which extends Zend_Form. That allows me to setup default decorators, ...etc.

I like this approach very much so far, though with this approach, it seems easy to make some design mistakes. What I'm still trying to clearly understand, as decorators are essentially *view* stuff. Also, most of my forms know how to populate their fields that point to foreign keys. So that's mixing of *model* as well. Forms are becoming the mixin place, which I don't like. Am I violating 100 design rules and will be cursed to eternity?  What do you think?

Best,
- Amr


On Mon, Mar 3, 2008 at 9:54 PM, Jim Scherer <[hidden email]> wrote:

I've decided to go the route of subclass of Zend_Form for my forms. Currently
I'm storing them in the application/models/ directory but that doesn't seem
right to me. I was prefixing them with formXXXXX.php. I didn't find anything
in the documentation on this.

I understand that I could put it in .lib/MyLib/Form/ but I think of that for
reusable forms that aren't application specific. For the most part my forms
are going to be application specific, so I feel that they should be
somewhere in the application/ structure.

Thanks in advance,

Jim
--
View this message in context: http://www.nabble.com/Zend_Form%3A-Directory-for-subclass%27d-forms--tp15812272s16154p15812272.html
Sent from the Zend MVC mailing list archive at Nabble.com.