I use the symfony serializer to deserialize REST server answers to objects.
The data returned by the server is someting like this (pseudocode, the answer itself is JSON):
// Endpoint 1
class Paginated {
public items:Object1[]
public page:int
}
// Endpoint 2
class Paginated {
public: items:Object2[]
public page:int
}
So, every answer is wrapped in the same "Paginated" object.
Sice I don't want to repeat the common members in every object I want to implement the objects in my Symfony app the same way as described in this pseudo code.
The problem is, that PHP isn't supporting generics to typehint the "items" member and the symfony serializer doesn't seem to offer something similar.
So, whats the best way to tackle this problem?