1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 21:58:10 +02:00

Dibi\DateTime: provides BC for serialized older versions [Closes #226] (#227)

This commit is contained in:
Roman Pavlík
2016-07-20 14:01:42 +02:00
committed by David Grudl
parent 6510fcce25
commit 8e8e6dfdca

View File

@@ -55,4 +55,17 @@ class DateTime extends \DateTime
return $this->format('Y-m-d H:i:s');
}
public function __wakeup()
{
if (isset($this->fix)) {
if (isset($this->fix[1])) {
$this->__construct($this->fix[0], new \DateTimeZone($this->fix[1]));
} else {
$this->__construct($this->fix[0]);
}
unset($this->fix);
}
}
}