Skip to content

Commit 4936d59

Browse files
authored
Update Extractor.php
1 parent d3e4b69 commit 4936d59

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Mapping/Extraction/Extractor.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
*/
1515
class Extractor
1616
{
17+
private $lastObjectType = '';
18+
private $fields = [];
19+
1720
/**
1821
* @param $object
1922
* @return Entity
@@ -50,8 +53,14 @@ private function getFields($object): array
5053
*/
5154
public function extract($object, $ignoreFilter = false): array
5255
{
53-
$fields = $this->getFields($object);
56+
if(get_class($object) != $this->lastObjectType)
57+
{
58+
$this->fields = $this->getFields($object);
59+
$this->lastObjectType = get_class($object);
60+
}
61+
5462
$reflection = new \ReflectionObject($object);
63+
$fields = &$this->fields;
5564
$array = [];
5665

5766
foreach ($fields as $field) {

0 commit comments

Comments
 (0)