[TYPO3-mvc] Use index of iteration attribute as array index
Peter Niederlag
typo3-list at niekom.de
Thu Jul 7 09:08:40 CEST 2011
Hello,
Am 06.07.2011 13:54, schrieb Dmitri Pisarev:
> I have added another function to my Article model class as this:
[...]
> I always had A QUESTION: is using such faux getters is a valid design
> pattern?
I can only tell you that is use them frequently. Personally I don't like
an "unspecific signature" that just says returns array of arrays to much.
If you want to take it one step further you could wrap it in an image
object and then go for article.image.file article.image.caption ....
define a transient (not persstable) property for the image object and
manage(create, access) that inside your getters. If you have write
access on the object this might need special caution/action, I never
used this approach in such a context yet.
Greets,
Peter
--
Peter Niederlag
http://www.niekom.de * TYPO3 & EDV Dienstleistungen *
More information about the TYPO3-project-typo3v4mvc
mailing list