本文整理汇总了PHP中Drupal\Core\Config\Entity\ConfigEntityBase::__sleep方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigEntityBase::__sleep方法的具体用法?PHP ConfigEntityBase::__sleep怎么用?PHP ConfigEntityBase::__sleep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\Entity\ConfigEntityBase
的用法示例。
在下文中一共展示了ConfigEntityBase::__sleep方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __sleep
/**
* {@inheritdoc}
*/
public function __sleep()
{
$keys = parent::__sleep();
unset($keys[array_search('executable', $keys)]);
return $keys;
}
示例2: __sleep
/**
* {@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;
}
示例3: __sleep
/**
* {@inheritdoc}
*/
public function __sleep()
{
$vars = parent::__sleep();
// Gathered contexts objects should not be serialized.
unset($vars[array_search('contexts', $vars)]);
return $vars;
}
示例4: __sleep
/**
* {@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;
}