[TYPO3-mvc] sub-models within the model table

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Apr 19 09:56:18 CEST 2010


Hey Masi,

> We further assume that we don't need tha address on it's own (quite likely in a shop application) and
> so we don't want to create a separate address table.
...
> My idea is now to model those two addresses as models with the customer model rather then a bunch of
> unrelated properties of the customer.

So what's your intention now. In the first paragraph you wrote that you 
don't want to have a dedicated address table, and in the second 
paragraph you say the opposite? Sorry, but didn't get.



Anyhow, I stood before a similar decision in January and decided for a 
general address model for several reasons:

a) I can use the same model for several records, in my case persons and 
stores
b) I can easily extend all address related records with new fields like 
the country, region, lat/long whatever may come in future
c) I can more easily use a dedicated viewHelper to render the addresses 
correctly, based on the country (changing the order of zip and region etc)
d) I can easily add support for multiple shipping/billing addresses once 
I need them


Although I spent hours/days thinking of the best and most flexible 
object/data structure, by writing the lines above I just noticed that I 
have one issue with my address model currently only storing address 
information and no personal data like the name when it comes to multiple 
shipping/billing addresses. I of course also need the name of the 
person/company in the address model then, because it most likely will 
also change in those cases. Hmm, let's see how I can rearrange this 
stuff in future :/

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list