[Foundation] made the Kernel serializable (to avoid weird error messages when used with PHPUnit)
This commit is contained in:
parent
5b941f58cb
commit
77f56a61f6
|
@ -25,7 +25,7 @@ use Symfony\Components\RequestHandler\RequestInterface;
|
|||
* @package Symfony
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.org>
|
||||
*/
|
||||
abstract class Kernel
|
||||
abstract class Kernel implements \Serializable
|
||||
{
|
||||
protected $bundles;
|
||||
protected $bundleDirs;
|
||||
|
@ -380,4 +380,16 @@ abstract class Kernel
|
|||
@rename($tmpFile, $file);
|
||||
chmod($file, 0644);
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array($this->environment, $this->debug));
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
list($environment, $debug) = unserialize($data);
|
||||
|
||||
$this->__construct($environment, $debug);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ use Symfony\Components\DependencyInjection\FileResource;
|
|||
use Symfony\Components\RequestHandler\RequestInterface;
|
||||
|
||||
|
||||
abstract class Kernel
|
||||
abstract class Kernel implements \Serializable
|
||||
{
|
||||
protected $bundles;
|
||||
protected $bundleDirs;
|
||||
|
@ -649,6 +649,18 @@ abstract class Kernel
|
|||
@rename($tmpFile, $file);
|
||||
chmod($file, 0644);
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
{
|
||||
return serialize(array($this->environment, $this->debug));
|
||||
}
|
||||
|
||||
public function unserialize($data)
|
||||
{
|
||||
list($environment, $debug) = unserialize($data);
|
||||
|
||||
$this->__construct($environment, $debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in New Issue