Example #1
0
 /**
  * {@inheritdoc}
  */
 public function __sleep()
 {
     $keys = parent::__sleep();
     unset($keys[array_search('executable', $keys)]);
     return $keys;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function __sleep()
 {
     $vars = parent::__sleep();
     // Avoid serializing plugin collections and the page executable as they
     // might contain references to a lot of objects including the container.
     $unset_vars = ['variants' => NULL, 'accessConditionCollection' => 'access_variants', 'executable' => NULL];
     foreach ($unset_vars as $unset_var => $configuration_key) {
         if (!empty($this->{$unset_var})) {
             if ($configuration_key) {
                 $this->set($configuration_key, $this->{$unset_var}->getConfiguration());
             }
             unset($vars[array_search($unset_var, $vars)]);
         }
     }
     return $vars;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function __sleep()
 {
     $vars = parent::__sleep();
     // Gathered contexts objects should not be serialized.
     unset($vars[array_search('contexts', $vars)]);
     return $vars;
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function __sleep()
 {
     $vars = parent::__sleep();
     // Ensure any plugin collections are stored correctly before serializing.
     // @todo Let https://www.drupal.org/node/2650588 handle this instead.
     foreach ($this->getPluginCollections() as $plugin_config_key => $plugin_collection) {
         $this->set($plugin_config_key, $plugin_collection->getConfiguration());
     }
     // Avoid serializing plugin collections and entities as they might contain
     // references to a lot of objects including the container.
     $unset_vars = ['variants', 'accessConditionCollection'];
     foreach ($unset_vars as $unset_var) {
         if (!empty($this->{$unset_var})) {
             unset($vars[array_search($unset_var, $vars)]);
         }
     }
     return $vars;
 }