diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 8651134..56cf9b6 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -17,6 +17,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\Serializer\SerializerInterface; /** * The DrupalKernel class is the core of Drupal itself. @@ -134,6 +135,21 @@ public function __construct($environment, $debug, ClassLoader $class_loader, $al } /** + * {@inheritdoc} + */ + public function serialize() { + return serialize(array($this->environment, $this->debug, $this->classLoader, $this->allowDumping)); + } + + /** + * {@inheritdoc} + */ + public function unserialize($data) { + list($environment, $debug, $class_loader, $allow_dumping) = unserialize($data); + $this->__construct($environment, $debug, $class_loader, $allow_dumping); + } + + /** * Overrides Kernel::init(). */ public function init() { diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php index 521e1ac..032d621 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php @@ -39,9 +39,9 @@ public function __construct($operation, AliasManagerInterface $path_alias_manage } /** - * Implements \Drupal\Core\Entity\EntityControllerInterface::createInstance(). + * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, $entity_type, $operation = NULL) { + public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info, $operation = NULL) { return new static( $operation, $container->get('path.alias_manager.cached') diff --git a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php index 2b90e18..61915d6 100644 --- a/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/DrupalKernel/DrupalKernelTest.php @@ -113,4 +113,21 @@ function testCompileDIC() { $modules = $container->getParameter('container.modules'); $this->assertEqual($modules['bundle_test'], drupal_get_filename('module', 'bundle_test')); } + + /** + * Tests kernel serialization/unserialization. + */ + public function testSerialization() { + $classloader = drupal_classloader(); + // @todo: write a memory based storage backend for testing. + $module_enabled = array( + 'system' => 'system', + 'user' => 'user', + ); + $kernel = new DrupalKernel('testing', FALSE, $classloader); + + $string = serialize($kernel); + $unserialized_kernel = unserialize($string); + $this->assertTrue($unserialized_kernel instanceof DrupalKernel); + } } diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php index 1c92682..56bc02a 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php @@ -42,7 +42,7 @@ public function __construct($operation, ViewsPluginManager $wizard_manager) { /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, $entity_type, $operation = NULL) { + public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info, $operation = NULL) { return new static( $operation, $container->get('plugin.manager.views.wizard') diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index 8d0ed29..b35ee01 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -56,7 +56,7 @@ public function __construct($operation, TempStoreFactory $temp_store_factory, Re /** * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, $entity_type, $operation = NULL) { + public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info, $operation = NULL) { return new static( $operation, $container->get('user.tempstore'), diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewPreviewFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewPreviewFormController.php index 26a2c02..b18c471 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewPreviewFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewPreviewFormController.php @@ -38,9 +38,9 @@ public function __construct($operation, TempStoreFactory $temp_store_factory) { } /** - * Implements \Drupal\Core\Entity\EntityControllerInterface::createInstance(). + * {@inheritdoc} */ - public static function createInstance(ContainerInterface $container, $entity_type, $operation = NULL) { + public static function createInstance(ContainerInterface $container, $entity_type, array $entity_info, $operation = NULL) { return new static( $operation, $container->get('user.tempstore')