-
Notifications
You must be signed in to change notification settings - Fork 87
Documentation clarifications (quick-start) #147
Comments
For reference: https://github.com/zendframework/zend-form/blob/master/src/Form.php#L176 Seems to me that the fact that Form uses a $factory is an implementation detail that isn't helpful for understanding how everything works from a user standpoint. $this->add could just as easily be new'ing the elements itself, rather than using a factory. |
I see also no benefit here. I would delete it.
But in this context the
But that doesn't mean it works. 😉
This detail is important for understanding how everything works. If you omit this information, then the description how it works is missing. |
Thanks @froschdesign So can I nix this sentence?: "The chief benefits to using the Factory are allowing you to store definitions in configuration, and usage of significant whitespace." a) because you agree about the whitespace thing, and b) because that benefit is already mentioned above here: "You can create the entire form and input filter at once using the Factory. This is particularly nice if you want to store your forms as pure configuration; you can then pass the configuration to the factory and be done."
I'm usually a fan, but in this case I'm trying to understand the benefit. Remember, I'm a ZF noob here.
I think what I may be missing is an understanding of the relationship between all of these guys. Forms extend Fieldsets which extend Elements. And both Forms and Fieldsets comprise Elements... Ah, looking through the source, the Zend\Form\Factory that is used in the first examples in quick-start is the same factory used by add(). That's what I was missing. Maybe that's obvious, and maybe that's useful? Or not? As a user, I maybe just want to know that Form::add and Factory::create_form can both take an array of configuration details. Thanks for the dialog and quick reply. |
This repository has been closed and moved to laminas/laminas-form; a new issue has been opened at laminas/laminas-form#17. |
Docs for ZF are so good and so essential for the often newbie-mystifying ZF. So I thought I'd seek a few clarifications to the quick start docs.
Happy to work this out and submit a PR once I understand...
From zend-form/quick-start
Item 1:
"significant whitespace" as in whitespace is significant (a la Python), or there's a significant amount? Either way, "huh"?
Item 2:
What does it mean in OOP or ZF for something to be 'backed by a Factory'? I know what factories are, and how they're used by ZF managers, but as a layman, I see the phrase "This allows you to extend it" and think "But I can extend any non-final class..."
And, many objects implement something like $this->add(), so how does Form being "backed by a Factory" make any difference here?
I think it is important to discuss some of the internals, as knowledge there can help people from being mystified when they 'new' their form in a controller and don't have any access to the usual managers. But some clarification or more explanation is needed for the above.
Thanks for great docs and I hope the above makes sense.
The text was updated successfully, but these errors were encountered: