[TYPO3-mvc] Mapping various Objects to a Domain Model

Henjo Hoeksma me at henjohoeksma.nl
Wed Jun 13 13:41:12 CEST 2012


HI Thomas,

aren't you just trying to add objects to the server object? If it is
attached the value is true, if not it isn't?

My usual way on building a model is to start with the ideal model situation
but then slim it down as much as possible to make it functional and as
uncomplicated as possible.

I hope this helps.

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Tue, Jun 12, 2012 at 8:49 PM, Thomas "Thasmo" Deinhamer <thasmo at gmail.com
> wrote:

> Hello folks,
>
> I have a similar domain object tree,
> with single table inheritance:
>
> Server
>  ServerA
>  ServerB
>  ServerC
>
> Now I have some simple objects, which
> hold some kind of "raw" data, which should
> be mapped to those domain objects.
>
> The simple object's structure is quite similar:
>
> Object
>  ObjectA
>  ObjectB
>  ObjectC
>
> Both, the domain objects and the simple objects
> have a certain amount of same named properties,
> but the properties of the simple objects must
> be mapped/converted to fit the property validation
> of the domain objects.
>
> Imagine "ObjectA" has a property "status" which's
> value can be "(string)ON" and "(string)OFF".
>
> The property "status" of the domain model "ServerA"
> has an equivalent property valued "(boolean)TRUE" or
> "(boolean)FALSE" which should be mapped from the
> property of "ObjectA".
>
> How would I do this in a nice and extendable way?
>
> I thought of adding a method "addObject(ObjectA $object)
> to each "Server" domain model, but this feels odd to me.
>
> Another way probably would be to create a "mapper"
> for each "Server:Object" pair which deals with it.
>
> Mapper
>  MapperA
>  MapperB
>  MapperC
>
> But this means a lot of classes to deal with,
> although it should be cleaner than a model method.
>
> Is there a preferred solution for this type of process?
> Is there any known design pattern which can solve this?
>
> Thanks a lot for your feedback!
>
> Thomas
> ______________________________**_________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>


More information about the TYPO3-project-typo3v4mvc mailing list