Skip to content

Commit

Permalink
repository map
Browse files Browse the repository at this point in the history
  • Loading branch information
mvkasatkin committed Oct 2, 2017
1 parent 4eda2f2 commit 4b4810f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/hydrator/Hydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function hydrate(array $data, $objectOrClass, array $map = null)
$object = $reflection->newInstanceWithoutConstructor();
}

if (!\is_array($map)) {
if (!\is_array($map) || !$map) {
$map = \array_keys($data);
$map = \array_combine($map, $map);
}
Expand Down Expand Up @@ -60,7 +60,7 @@ public function extract($object, array $map = null): array
$className = \get_class($object);
$reflection = $this->getReflection($className);

if (!\is_array($map)) {
if (!\is_array($map) || !$map) {
$propertyList = $this->getReflectionPropertyList($className);
$map = \array_combine($propertyList, $propertyList);
}
Expand Down

0 comments on commit 4b4810f

Please sign in to comment.