Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
CakePHP ORM: Fix primaryKey warning
Browse files Browse the repository at this point in the history
The return from the `primaryKey()` method can be both array and string, so this should be accounted for.
  • Loading branch information
davidyell committed Aug 20, 2015
1 parent 5015592 commit e7acaa7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Faker/ORM/CakePHP/EntityPopulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ public function execute($class, $insertedEntities, $options = [])
}

$pk = $table->primaryKey();
return $entity->{$pk};
if (is_string($pk)) {
return $entity->{$pk};
}

return $entity->{$pk[0]};
}

public function setConnection($name)
Expand Down

0 comments on commit e7acaa7

Please sign in to comment.