[TYPO3-mvc] Using external APIs in DDD

Martin Kutschker masi-no at spam-typo3.org
Tue Feb 9 14:19:20 CET 2010


Christine Gerpheide schrieb:
Conceptually the only problem I see there is that this API object
> cannot be a singleton, because the API key I'll be sending will change
> depending on the logged in user, and I had thought services were meant to be
> singletons.

They are meant to be stateless. But in your case the state won't change within a session as the user
will not, right? So I guess it's ok that you have a single service object during the session.
Perhaps you will want to set a up a builder object that feeds the session info (ie the correct API
key for the user) to the object.

Masi


More information about the TYPO3-project-typo3v4mvc mailing list