in "friendsofsymfony/rest-bundle": "~1.4",
we have setSerializationContext from "jms/serializer-bundle": "^1.1.0",
in this context we set gropu and enable depth
return View::create()
->setStatusCode(200)
->setData($certificatesResponse)
->setSerializationContext(
SerializationContext::create()
->enableMaxDepthChecks()
->setGroups(array('certificates_by_parameters'))
);
early in "friendsofsymfony/rest-bundle": "~1.4",
we have this function for View class from RestBundle
/**
* Sets the serialization context.
*
* @param SerializationContext $serializationContext
*
* @return View
*/
public function setSerializationContext(SerializationContext $serializationContext)
{
$this->serializationContext = $serializationContext;
return $this;
}
In "friendsofsymfony/rest-bundle": "^2.0",
I don't find this function, how to set serialized context in 2.0 version ?
You should look here https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/UPGRADING-2.0.md.
==>
View::setSerializationContext and View::getSerializationContext have been removed. Use View::setContext and View::getContext together with the new Context class instead.
Before:
After: