Closed wanze closed 5 years ago
Hello
What do you think about the proposed fix? I can send you a pull request containing the fix with a test case
That sounds great. PR is welcome!
Other than that I found that the AbstractManager::fromArray() and AbstractManager::toArray() are not part of the ManagerInterface
These two methods were for internal use, a syntactic sugar;
In fact, outside the manager, we recommend
$client->getHydrator()->hydrate
and $client->getHydrator()->extract
But now, it looks like adding them to the ManagerInterface
is fine
fixed
Description
I am trying to use the built in hydrator service to serialize multiple products. It works fine for a single product, but fails when trying to serialize multiple objects. The following exception is thrown:
To reproduce the error, one can fetch multiple products and then try to serialize them:
How to fix
The
Hydrator::extract
method must create a newSerializationContext
for each call, instead of using the context initialized in its constructor:@slince What do you think about the proposed fix? I can send you a pull request containing the fix with a test case. Other than that I found that the
AbstractManager::fromArray()
andAbstractManager::toArray()
are not part of theManagerInterface
. Is there a reason to not add this methods to the contract so that IDEs are able to autocomplete these methods when dealing with interfaces?Thanks for creating this library, it is really easy to use! 👍
Cheers