use a form using service locator

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

use a form using service locator

graphicmist
Hi,

I am just getting my hands on zf2. I have scenario in which i have created a user form which is used in application in two places. I want to know what is the best practice? i have two options:

1) to instantiate the form object directly in controller by including the form class.
2) get the form via service manager.

i have one more doubt. does accessing everything via service locator has some effect on application, i mean does services get accessed on runtime or how does it work?