Skip to content

Commit

Permalink
Removing the useless string callback from the findOrCreate
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Apr 25, 2016
1 parent 656adb7 commit 8b36769
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
6 changes: 0 additions & 6 deletions src/ORM/Table.php
Expand Up @@ -1245,12 +1245,6 @@ protected function _getFindOrCreateQuery($search)
if ($search instanceof Query) {
return $search;
}
if (is_string($search)) {
if (method_exists($this, $search)) {
return $this->{$search}();
}
throw new InvalidArgumentException('Method `' . $search . '` does not exist!');
}
return $this->find()->where($search);
}

Expand Down
11 changes: 0 additions & 11 deletions tests/TestCase/ORM/TableTest.php
Expand Up @@ -5390,17 +5390,6 @@ function ($article) {
$this->assertEquals(2, $article->author_id);
}

/**
* Test that exceptions from the findOrCreate are thrown.
*
* @expectedException \InvalidArgumentException
*/
public function testFindOrCreateException()
{
$articles = TableRegistry::get('Articles');
$articles->findOrCreate('doesNotExist');
}

/**
* Test that creating a table fires the initialize event.
*
Expand Down

0 comments on commit 8b36769

Please sign in to comment.