Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Data/HasOrigin.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@

trait HasOrigin
{
private $resolvingValues = false;
protected $resolvingValues = false;

/**
* @var string
Expand Down
2 changes: 1 addition & 1 deletion src/Entries/Entry.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -1109,6 +1109,6 @@ public function __sleep()
$this->slug = $slug($this);
}

return array_keys(Arr::except(get_object_vars($this), ['cachedKeys', 'computedCallbackCache', 'siteCache', 'augmentationReferenceKey']));
return array_keys(Arr::except(get_object_vars($this), ['cachedKeys', 'computedCallbackCache', 'siteCache', 'augmentationReferenceKey', 'resolvingValues']));
}
}
27 changes: 27 additions & 0 deletions tests/Data/Entries/EntryTest.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -2698,4 +2698,31 @@ public function it_detects_recursive_augmentation()

$entry->values();
}

#[Test]
public function entries_can_be_serialized_after_resolving_values()
{
$entry = EntryFactory::id('entry-id')
->collection('test')
->slug('entry-slug')
->create();

$customEntry = CustomEntry::fromEntry($entry);

$serialized = serialize($customEntry);
$unserialized = unserialize($serialized);

$this->assertSame('entry-slug', $unserialized->slug);
}
}

class CustomEntry extends Entry
{
public static function fromEntry(Entry $entry)
{
return (new static)
->slug($entry->slug)
->collection($entry->collection)
->data($entry->data);
}
}