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
Hello, in my DataProvider I'm getting data back from an aggregation builder that is returning an object of class '\ApiPlatform\Core\Bridge\Doctrine\MongoDbOdm\Paginator'. I need to serialize the data to store in a Redis cache, and deserialize it when pulling from the cache. I can serialize it just fine and see it in the cache, but when I try to deserialize it I'm getting the following error.
Cannot create an instance of \"\\ApiPlatform\\Core\\Bridge\\Doctrine\\MongoDbOdm\\Paginator\" from serialized data because its constructor requires parameter \"mongoDbOdmIterator\" to be present.
Too few arguments to function Doctrine\\ODM\\MongoDB\\Iterator\\CachingIterator::__construct(), 0 passed in /var/www/cpic/src/DataProvider/Feed/ActivitiesFeedDataProvider.php on line 162 and exactly 1 expected
It seems that requires __construct(Traversable $iterator). So I tried:
Cannot create an instance of \"\\ApiPlatform\\Core\\Bridge\\Doctrine\\MongoDbOdm\\Paginator\" from serialized data because its constructor requires parameter \"mongoDbOdmIterator\" to be present.
Any guidance on how to pass the mongoDbOdmIterator to the constructor, or any better way of serializing/deserializing this object? TIA
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, in my DataProvider I'm getting data back from an aggregation builder that is returning an object of class '\ApiPlatform\Core\Bridge\Doctrine\MongoDbOdm\Paginator'. I need to serialize the data to store in a Redis cache, and deserialize it when pulling from the cache. I can serialize it just fine and see it in the cache, but when I try to deserialize it I'm getting the following error.
Cannot create an instance of \"\\ApiPlatform\\Core\\Bridge\\Doctrine\\MongoDbOdm\\Paginator\" from serialized data because its constructor requires parameter \"mongoDbOdmIterator\" to be present.
My DataProvider:
After returning $data, I'm trying to add something like:
Based on this, I've also tried
Which results in the error
Too few arguments to function Doctrine\\ODM\\MongoDB\\Iterator\\CachingIterator::__construct(), 0 passed in /var/www/cpic/src/DataProvider/Feed/ActivitiesFeedDataProvider.php on line 162 and exactly 1 expected
It seems that requires __construct(Traversable $iterator). So I tried:
which resulted in the original error:
Cannot create an instance of \"\\ApiPlatform\\Core\\Bridge\\Doctrine\\MongoDbOdm\\Paginator\" from serialized data because its constructor requires parameter \"mongoDbOdmIterator\" to be present.
Any guidance on how to pass the mongoDbOdmIterator to the constructor, or any better way of serializing/deserializing this object? TIA
Beta Was this translation helpful? Give feedback.
All reactions