Skip to content
Permalink
Browse files

#8687 Minor code improvements

  • Loading branch information...
burzum committed Apr 21, 2016
1 parent 7c104a9 commit 656adb7c0a7ba63fdb92200da84b1b24e40a49b2
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/ORM/Table.php
@@ -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);
}

0 comments on commit 656adb7

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