From e0c965a366f0e78f45453efd461f1b43c60e9ef0 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sun, 18 Aug 2019 11:23:56 +0100 Subject: [PATCH] adjusting implementation --- .../DaftTypedObjectMemoryRepository.php | 28 ++----------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/Tests/Fixtures/DaftTypedObjectMemoryRepository.php b/Tests/Fixtures/DaftTypedObjectMemoryRepository.php index af400e8..713b9c7 100644 --- a/Tests/Fixtures/DaftTypedObjectMemoryRepository.php +++ b/Tests/Fixtures/DaftTypedObjectMemoryRepository.php @@ -86,31 +86,7 @@ public function UpdateTypedObject( parent::UpdateTypedObject($object); - /** - * @var array - */ - $properties = $object::TYPED_PROPERTIES; - - /** - * @var array{id:int, name:string} - */ - $data = array_combine( - $properties, - array_map( - /** - * @return scalar|array|object|null - */ - function (string $property) use ($object) { - /** - * @var scalar|array|object|null - */ - return $object->$property; - }, - $properties - ) - ); - - $this->data[$hash] = $data; + $this->data[$hash] = $object->__toArray(); } public function RemoveTypedObject(array $id) : void @@ -153,7 +129,7 @@ public function MaybeRecallTypedObject( /** * @var T1 */ - $object = new $type($row); + $object = $type::__fromArray($row); $this->UpdateTypedObject($object);