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

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Apr 19 16:02:59 CEST 2010


Hey,

> I think I made myself not clear. There will only be one table "customer". And the customer model
> looks like this:
>
> class customer {
>    // @var string
>    var $name;
>    // @var Address_Model
>    var $shipping;
>    // @var Address_Model
>    var $billing;
> }
>
> Perhaps I should have written nested model instead of sub model.

ok, now it's a bit more clearly :) So this is reflecting the proposal I 
wrote in my other posting and also the way I'd do and have done it.
But as I mentioned in my other posting, I currently miss some additional 
"name" field in my implementation of a generic address model, because 
the recipients name written on the billing/shipping address/envelope 
might not be the same name as the customer/user itself - especially when 
it comes to multiple shipping/billing addresses. So maybe keep that in 
mind when modeling your models :)

class customer {
	var $firstName;
	var $lastName;
	var $salutation;
	var $phoneNumber;
	// @var Tx_Extbase_ObjectStorage<Address_Model>
	var $shippingAddress;
	// @var Tx_Extbase_ObjectStorage<Address_Model>
	var $billingAddresses;
}

class address {
	// type of the address (private,business,...)
	var $type;
	// recipient name, if different from related customer
	var $name;
	var $address;
	var $postOfficeBox;
	var $zip;
	var $city;
	var $region;
	var $country;
}
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list