Skip to content

Commit

Permalink
#8687 Minor code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Apr 21, 2016
1 parent 7c104a9 commit 656adb7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/ORM/Table.php
Expand Up @@ -1240,15 +1240,16 @@ public function findOrCreate($search, callable $callback = null)
* @param array|\Cake\ORM\Query|string $search The criteria to find existing records by.
* @return \Cake\ORM\Query
*/
protected function _getFindOrCreateQuery($search) {
protected function _getFindOrCreateQuery($search)
{
if ($search instanceof Query) {
return $search;
} elseif (is_string($search)) {
}
if (is_string($search)) {
if (method_exists($this, $search)) {
return $this->{$search}();
} else {
throw new InvalidArgumentException('Method `' . $search . '` does not exist!');
}
throw new InvalidArgumentException('Method `' . $search . '` does not exist!');
}
return $this->find()->where($search);
}
Expand Down

0 comments on commit 656adb7

Please sign in to comment.