From a66d56719876db65512d44a8498da49af472bb76 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 6 Feb 2015 11:36:56 -0500 Subject: [PATCH] Moved ugly __sleep magic back to only place where it's needed. --- .../I18n/Translator/TranslatorAwareTrait.php | 15 --------------- module/VuFind/src/VuFind/Search/Base/Options.php | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareTrait.php b/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareTrait.php index 33c13cf6e24..146158320f0 100644 --- a/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareTrait.php +++ b/module/VuFind/src/VuFind/I18n/Translator/TranslatorAwareTrait.php @@ -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; - } } diff --git a/module/VuFind/src/VuFind/Search/Base/Options.php b/module/VuFind/src/VuFind/Search/Base/Options.php index 45be6b20756..5ff15a119c0 100644 --- a/module/VuFind/src/VuFind/Search/Base/Options.php +++ b/module/VuFind/src/VuFind/Search/Base/Options.php @@ -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 -- GitLab