public function __wakeup()
{
// Restore ReflectionClass and properties
$this->reflClass = new \ReflectionClass($this->name);
$this->instantiator = $this->instantiator ?: new Instantiator();
foreach ($this->fieldMappings as $field => $mapping) {
if (isset($mapping['declared'])) {
$reflField = new \ReflectionProperty($mapping['declared'], $field);
} else {
$reflField = $this->reflClass->getProperty($field);
}
$reflField->setAccessible(true);
$this->reflFields[$field] = $reflField;
}
}