You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a case where I'd like to specify properties/entities at runtime. Doing this using the groups tactic will result in a unwanted high maintenance situation. As a lot of groups need to be defined for many possible combinations. Unless groups is abused and a group is defined for every property. I guess that it's not only wanted, but also not the idea behind groups.
I would settle for a builder approach, something that the SerializationContext class might embrace. An idea is to introduce a certain profile/definition:
// Accept requirements from the request$serializationProfile = SerializationProfile::create( $request->getParams() );
// Last-minute override$serializationProfile->getRelation('orders')->exclude(array('profit'));
// just for demonstration$serializationProfile->only(array('id', 'username', 'e-mail'));
// The actual serialization$serializer->serialize($model, 'json', $serializationProfile);
This way it's trivial for a client to specify fields and optionally what resources to embed. Example:
Hi,
I have a case where I'd like to specify properties/entities at runtime. Doing this using the groups tactic will result in a unwanted high maintenance situation. As a lot of groups need to be defined for many possible combinations. Unless groups is abused and a group is defined for every property. I guess that it's not only wanted, but also not the idea behind groups.
I would settle for a builder approach, something that the SerializationContext class might embrace. An idea is to introduce a certain profile/definition:
This way it's trivial for a client to specify fields and optionally what resources to embed. Example:
/user/42?embed=address,orders.product&orders.product.properties=id,name
This should:
The text was updated successfully, but these errors were encountered: