Skip to content

Commit

Permalink
Remove __sleep & __wakeup from SerializesModels (#44847)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Kujawa authored Nov 6, 2022
1 parent c76c3bd commit 033b956
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions src/Illuminate/Queue/SerializesModels.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,6 @@ trait SerializesModels
{
use SerializesAndRestoresModelIdentifiers;

/**
* Prepare the instance for serialization.
*
* @return array
*/
public function __sleep()
{
$properties = (new ReflectionClass($this))->getProperties();

foreach ($properties as $property) {
$property->setValue($this, $this->getSerializedPropertyValue(
$this->getPropertyValue($property)
));
}

return array_values(array_filter(array_map(function ($p) {
return $p->isStatic() ? null : $p->getName();
}, $properties)));
}

/**
* Restore the model after serialization.
*
* @return void
*/
public function __wakeup()
{
foreach ((new ReflectionClass($this))->getProperties() as $property) {
if ($property->isStatic()) {
continue;
}

$property->setValue($this, $this->getRestoredPropertyValue(
$this->getPropertyValue($property)
));
}
}

/**
* Prepare the instance values for serialization.
*
Expand Down

0 comments on commit 033b956

Please sign in to comment.