1 Reply Latest reply on Jul 23, 2011 6:58 PM by Andrew Sinning

    getting nested valueObjects from a data-service

    Andrew Sinning

      I'm working FB 4.5 for PHP.  I'm very intrigued by the data/service design pattern and the way FB automatically configures a valueObject with getters and setters, and the way the connection to the server is abstracted.


      However, I have a few questions, and I'm concerned that the automation my complicate what I wish to do.


      I've created a service that returns an array of objects of type "Setting", which in turn has properties including other objects and arrays of objects.


      When I use the data/service wizard, it automatically creates a valueObject called "Setting".


      I'd like to extend Setting so that valueObjects for the nested objects are created.  I can use the wizard to create the appropriate valueObjects by calling methods in my service that return instances of these objects.


      The next step would be to modify the Setting class so that as instances are being created, the data for the nested objects are passed on to create client-side instances of the corresponding valueObjects.


      E.g., lets say that the primary valueObject being returned is Person, but each Person has a corresponding array of Like objects.  I'd like to modify the Person object so that when the data comes down from the server, corresponding "Like" objects are created.


      How would I do this?