Skip to content

Commit

Permalink
fix: handle cases where an uninitialized proxy gets a postFlush event.
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Sep 18, 2024
1 parent aefb72d commit 04ee150
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Changelog

## 1.3.1

* fix: handle cases where an uninitialized proxy gets a `postFlush` event.

## 1.3.0

* chore: php-cs-fixer run
* feat: php 8.4 compatibility by @priyadi in #4
* Create dependabot.yml by @priyadi in #5
* chore: rectorization by @priyadi in #7


## 1.2.0

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"rekalogika/direct-property-access": "^1.1.2 || ^1.2",
"symfony/config": "^6.0 || ^7.0",
"symfony/dependency-injection": "^6.0 || ^7.0",
"symfony/http-kernel": "^6.0 || ^7.0"
"symfony/http-kernel": "^6.0 || ^7.0",
"symfony/var-exporter": "^6.4 || ^7.1"
},
"require-dev": {
"phpstan/phpstan": "^1.12",
Expand Down
8 changes: 8 additions & 0 deletions src/ReconstitutorProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use Rekalogika\Reconstitutor\Contract\ReconstitutorInterface;
use Rekalogika\Reconstitutor\Contract\ReconstitutorResolverInterface;
use Symfony\Component\VarExporter\LazyObjectInterface;

final class ReconstitutorProcessor
{
Expand Down Expand Up @@ -49,6 +50,13 @@ public function onLoad(object $object): void

public function onSave(object $object): void
{
if (
$object instanceof LazyObjectInterface
&& !$object->isLazyObjectInitialized()
) {
return;
}

foreach ($this->getReconstitutors($object) as $reconstitutor) {
$reconstitutor->onSave($object);
}
Expand Down

0 comments on commit 04ee150

Please sign in to comment.