Closed
Description
I'm using a custom translation loader where the loader is the resource, a database loader like this one. The problem is that as of symfony 2.7, the creating of the cache is slightly changed, it also serializes the resource now. Because my resource is using an entity manager to fetch the translations, it tries to serialize the EM and this of course fails.
A solution is to implement the Serializable
interface or to use the spl_object_hash()
instead.
// 2.6
private function getCatalogueCachePath($locale)
{
return $this->cacheDir.'/catalogue.'.$locale.'.'.sha1(serialize($this->fallbackLocales)).'.php';
}
// 2.7
private function getCatalogueCachePath($locale)
{
$catalogueHash = sha1(serialize(array(
'resources' => isset($this->resources[$locale]) ? $this->resources[$locale] : array(),
'fallback_locales' => $this->fallbackLocales,
)));
return $this->cacheDir.'/catalogue.'.$locale.'.'.$catalogueHash.'.php';
}