On Tue, Dec 17, 2013 at 12:57 PM, MichaelB <mr...@mckanes.com> wrote:
> Thanks Matthew for your answer!
>
> Little other questions about it..
>
> Is it a performance difference between creating a controller factory in a
> different class OR creating all in "getControllerConfig()" ?
> (http://www.zfdaily.com/2012/07/getting-dependencies-into-zf2-controllers/)

Putting it in a class actually is better, for a few reasons.

- First, if you never use the factory, no code is loaded. If you
define it in getControllerConfig(), you're defining a closure in each
and every request.
- Second, it gives you the option of extending or otherwise re-using
the factory later.

> And last question.. ;-) Form should be injected too ?

Typically, yes -- particularly as you can now seed the form elements,
hydrators, input filters and inputs, filters, and validators via
plugin managers, you'll likely want access to those plugin managers to
create your form -- so why not use a factory? :)


-- 
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to