Skip to content

Commit

Permalink
Если по первичному ключу с использованием find() ничего не найдено, в…
Browse files Browse the repository at this point in the history
…озвратим null
  • Loading branch information
kazartsev committed Sep 14, 2016
1 parent 1e7b6ac commit 984faa9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Sberned/RestORM/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,12 @@ public static function find(int $id)

$newQuery = new Builder($class->getClassName(), $class->getUrl(), $class->getLink() . '/' . $id, 'get', true, []);
$newQuery->setValues(self::$_values);
$res = $newQuery->send();

try {
$res = $newQuery->send();
} catch (MassAssignmentException $e) {
return null;
}

$className = $class->className;

Expand Down

0 comments on commit 984faa9

Please sign in to comment.