Skip to content

Commit

Permalink
Fix #12163
Browse files Browse the repository at this point in the history
  • Loading branch information
Joep Roebroek committed May 31, 2018
1 parent cfaa31c commit 39e89f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ORM/Table.php
Expand Up @@ -1675,13 +1675,13 @@ protected function _transactionCommitted($atomic, $primary)
*/
public function findOrCreate($search, callable $callback = null, $options = [])
{
$options += [
$options = new ArrayObject($options + [
'atomic' => true,
'defaults' => true,
];
]);

$entity = $this->_executeTransaction(function () use ($search, $callback, $options) {
return $this->_processFindOrCreate($search, $callback, $options);
return $this->_processFindOrCreate($search, $callback, $options->getArrayCopy());
}, $options['atomic']);

if ($entity && $this->_transactionCommitted($options['atomic'], true)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/ORM/TableTest.php
Expand Up @@ -6150,7 +6150,7 @@ public function testFindOrCreateNoDefaults()
public function testFindOrCreateTransactions()
{
$articles = $this->getTableLocator()->get('Articles');
$articles->getEventManager()->on('Model.afterSaveCommit', function ($event, $entity) {
$articles->getEventManager()->on('Model.afterSaveCommit', function (Event $event, EntityInterface $entity, ArrayObject $options) {
$entity->afterSaveCommit = true;
});

Expand Down

0 comments on commit 39e89f3

Please sign in to comment.