You are here

public function Submission::__wakeup in Little helpers 7

Deprecated

Serializing submission objects is not a good idea especially for long term storage.

File

src/Webform/Submission.php, line 169

Class

Submission
A useful wrapper for webform submission objects.

Namespace

Drupal\little_helpers\Webform

Code

public function __wakeup() {
  if (!($node = node_load($this->nid))) {
    throw new \UnexpectedValueException('Tried to __wakeup with non-existing node.');
  }
  if (!($submission = webform_get_submission($this->nid, $this->sid))) {
    throw new \UnexpectedValueException('Tried to __wakeup with non-existing submission.');
  }
  $this
    ->__construct($node, $submission);
}