Skip to content
Snippets Groups Projects
Commit a66d5671 authored by Demian Katz's avatar Demian Katz
Browse files

Moved ugly __sleep magic back to only place where it's needed.

parent 45bebcdf
No related merge requests found
......@@ -118,19 +118,4 @@ trait TranslatorAwareTrait
return $msg;
}
/**
* Sleep magic method -- the translator can't be serialized, so we need to
* exclude it from serialization. Since we can't obtain a new one in the
* __wakeup() method, it needs to be re-injected from outside.
*
* @return array
*/
public function __sleep()
{
$vars = get_object_vars($this);
unset($vars['translator']);
$vars = array_keys($vars);
return $vars;
}
}
......@@ -709,4 +709,19 @@ abstract class Options implements TranslatorAwareInterface
// No limit by default:
return -1;
}
/**
* Sleep magic method -- the translator can't be serialized, so we need to
* exclude it from serialization. Since we can't obtain a new one in the
* __wakeup() method, it needs to be re-injected from outside.
*
* @return array
*/
public function __sleep()
{
$vars = get_object_vars($this);
unset($vars['translator']);
$vars = array_keys($vars);
return $vars;
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment