Just had a long look through it all, it only seems like hes using Doctrine and ZendDb to login/register a user. I couldn't really see anything related to the problem I'm having though. He's injecting into 1 model that's used in his controller (user).
The problem I have is that I need to inject into a model that's not part of the controller but required by the User. I've not seen any example of this yet, all the examples I've seen so far are basic 1 model, 1 controller concepts like AlbumController, getAlbums where DI makes perfect sense, it all ties into it perfectly. Not really seen anything with more of a backend doing stuff not directly associated with the controller. When I first got DI working I sort of had a 'oooo aaah, that makes perfect sense!' moment where you specify all the dependencies for everything and as soon as they're needed they're given them but that only works when directly in the controller and now I'm confused as to why it's not how I thought it would be. Surely DI was made to be a little more complex than to give access to a UserMapper from the Login/Register page and give access to AlbumMapper from the displayAlbums page? I do like his DiDbAdapter class though as in the akrabat ZF2 tutorial he injects the DbAdapter directly into the table... but I have about 90 tables so I'd have to copy and paste the DI code 90 times right? I guess EDP injects it into one, sets the default adapter there and then uses it throughout -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-DI-into-Models-not-directly-within-a-controller-tp4113674p4124962.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: [email protected] Info: http://framework.zend.com/archives Unsubscribe: [email protected]
