Skip to content
Permalink
Browse files

Changing toArray check to use instanceof

  • Loading branch information...
Patrick Conroy
Patrick Conroy committed Jun 16, 2015
1 parent 529a427 commit c69c458aa258b76ba5b1469fdd822292d9764d72
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/Datasource/EntityTrait.php
@@ -440,13 +440,13 @@ public function toArray()
if (is_array($value)) {
$result[$property] = [];
foreach ($value as $k => $entity) {
if (method_exists($entity, 'toArray')) {
if ($entity instanceof EntityInterface) {
$result[$property][$k] = $entity->toArray();
} else {
$result[$property][$k] = $entity;
}
}
} elseif (method_exists($value, 'toArray')) {
} elseif ($value instanceof EntityInterface) {
$result[$property] = $value->toArray();
} else {
$result[$property] = $value;

0 comments on commit c69c458

Please sign in to comment.
You can’t perform that action at this time.