--> How would I manage a case like this?
Thanks for your help!
--
You received this message because you are subscribed to the Google Groups "RESTing with Symfony" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resting-with-sym...@googlegroups.com.
To post to this group, send email to resting-wi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/resting-with-symfony/87954c9f-a1db-4781-9341-d3f27051ebd7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
While it could be a bit overkill depending on how large your application is, I'd go for a DTO layer.
On Tue, Jul 15, 2014 at 9:27 AM, Ulrich Lichtenegger <ulil...@googlemail.com> wrote:
Hi,
I am building a REST API with Symfony2, FOSRestBundle and JMSSerializer. I am using a relational Database together with Doctrine ORM.
Now i wonder how i would expose certain properties of my objects without polluting my Entity Layer too much. Imagine the following use-case:
- In the Database, an entity has 2 fields: a date and a foreign key to an event. (which seems to be correct in an relational db)
- By convention, only one of this can have a value, the other one is null (valid to date or valid to an event)
- In doctrine, I have 2 properties which represent the state.
- In my api, I would like to have only one property (validTo) and another property which says which type the validTo field has. (datetype "date" or "event")
--> How would I manage a case like this?
- Are you using something like an DTO layer for cases like this? (Data Transfer Objects, objects with all properties that I want to expose)
- I could use VirtualProperties with JMSSerializer, but as far as I know I wont have FormType support any more when I POST an object from outside?
Thanks for your help!
--
You received this message because you are subscribed to the Google Groups "RESTing with Symfony" group.
To unsubscribe from this group and stop receiving emails from it, send an email to resting-with-symfony+unsub...@googlegroups.com.