diff --git a/src/Sberned/RestORM/Builder.php b/src/Sberned/RestORM/Builder.php index ed15abd..c6aa01f 100644 --- a/src/Sberned/RestORM/Builder.php +++ b/src/Sberned/RestORM/Builder.php @@ -128,7 +128,7 @@ public function send() if($this->basicAuth) { $result->setUser($this->authLogin())->setPass($this->authPass()); } - + $result->setOption(CURLOPT_SSL_VERIFYPEER, false); $res = $result->send(); if($res->statusCode < 400) { $this->result = Model::convertToObject(json_decode($res->body)); diff --git a/src/Sberned/RestORM/Model.php b/src/Sberned/RestORM/Model.php index f63d903..96205f0 100644 --- a/src/Sberned/RestORM/Model.php +++ b/src/Sberned/RestORM/Model.php @@ -177,8 +177,7 @@ public function first(array $columns = []) $dataObj = $aliasList; } - if (empty($res->$dataObj)) { - return null; + if (!empty($res->$dataObj)) { $data = array_first($res->$dataObj); if(!empty($data)) { foreach ($data as $key => $val) { @@ -187,6 +186,8 @@ public function first(array $columns = []) } $class->exist = true; return $class; + } else { + return null; } }