Event serializer abstraction

Home   »   Event serializer abstraction

 static::class,
            'event' => (new Laminas\Hydrator\ReflectionHydrator())->extract($this)
        ];
    }
}
hydrator = $hydrator;
    }
 
    public function translate(string $jsonEvent): Event
    {
        $decoded = json_decode($jsonEvent, true);
        try {
            return $this->hydrator->hydrate($decoded['event'], (new ReflectionClass($decoded['type']))->newInstanceWithoutConstructor());
        } catch (ReflectionException $e) {
            throw new EventNotFoundException();
        }
    }
}
foo = $foo;
        $this->bar = $bar;
    }
}

Leave a Reply

Your email address will not be published.