Skip to content

Commit 4a9200b

Browse files
committed
fix property access when no hooks
Signed-off-by: Robert Landers <landers.robert@gmail.com>
1 parent 7cba4cb commit 4a9200b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/State/EntityHistory.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
use Crell\Serde\Attributes\Field;
4949
use Generator;
5050
use Override;
51-
use PropertyHookType;
5251
use ReflectionAttribute;
5352
use ReflectionClass;
5453
use ReflectionException;
@@ -226,12 +225,12 @@ private function execute(Event $original, string $operation, array $input): Gene
226225
if (! $this->checkAccessControl($this->user, $this->from, ...$operationReflection->getAttributes(AccessControl::class, ReflectionAttribute::IS_INSTANCEOF))) {
227226
throw new SecurityException('Access denied');
228227
}
229-
$operationReflection = match ($operation) {
230-
'get' => $operationReflection->getHook(PropertyHookType::Get),
231-
'set' => $operationReflection->getHook(PropertyHookType::Set),
228+
$result = match ($operation) {
229+
'get' => $this->state->{$property},
230+
'set' => $this->state->{$property} = $input[0],
232231
default => throw new ReflectionException('Unknown operation'),
233232
};
234-
goto done;
233+
goto finalize;
235234
}
236235

237236
$operationReflection = $reflector->getMethod($operation);
@@ -281,6 +280,8 @@ private function execute(Event $original, string $operation, array $input): Gene
281280
}
282281
}
283282

283+
finalize:
284+
284285
if ($replyTo) {
285286
foreach ($replyTo as $reply) {
286287
yield WithPriority::high(

0 commit comments

Comments
 (0)