Ludwig Ruderstaller wrote > Hi, > > After reading much about the Service Manager implementation in ZF2 and > trying out a few things, I think I finally get the concept and the idea > behind it. > > But please help me understand one thing. > > Imagine I have a medium size database with 10 entities. Along them are > 10 form definition. > > The input filter is described in the entity. > > in the service_manager I have a factory for each entity. (as the code is > mostly the same the factories extend from an base entityFactory). > then I have a factory for each Form (again extended by a base > formFactory) which along other things inject the input filter from the > entity. > > Is this really the right way? > > It seems extremly redundant to do this for each entity/form. > There are abstract_factories which can work around this, but after what > I have read, this is more of a fallback. Is this so? Can't I not just > have a formFactory and a entityFactory? I would just have to implemnt > the canCreateServiceWithName method to only target form respectively > entity classes. > > Is there a downside to have multiple abstract factory classes? > > What is the best practice ? > > TIA > Ludwig
In my opinion the best way is to use just one factory formFactory and a entityFactory for each of your Forms and Entities. Obviously they would need to handle some kind of identifier to know which object to create. ----- Cheers, -- Luke Mierzwa -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-Service-Manager-best-practice-tp4657008p4657009.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
