@@ -50,7 +50,7 @@ public function getAllDocs($options = []) : array
50
50
// we have some data - extract the docs to return
51
51
$ docs = [];
52
52
foreach ($ json_data ["rows " ] as $ document ) {
53
- $ docs [] = new Document ($ this -> client , $ this -> db_name , $ document ["doc " ]);
53
+ $ docs [] = new Document ($ this , $ document ["doc " ]);
54
54
}
55
55
return $ docs ;
56
56
} else {
@@ -93,7 +93,7 @@ public function create($doc)
93
93
$ id = $ response_data ['id ' ];
94
94
// all good. Let's fetch the doc and return it
95
95
$ fetched_data = json_decode ($ this ->client ->get ('/ ' . $ this ->db_name . '/ ' . $ id )->getBody (), true );
96
- return new Document ($ this -> client , $ this -> db_name , $ fetched_data );
96
+ return new Document ($ this , $ fetched_data );
97
97
}
98
98
} catch (\GuzzleHttp \Exception \ConnectException $ e ) {
99
99
throw new Exception \ServerException (
@@ -118,7 +118,7 @@ public function getDocById($id) : Document
118
118
$ response = $ this ->client ->request ("GET " , $ endpoint );
119
119
if ($ response ->getStatusCode () == 200 ) {
120
120
if ($ data = json_decode ($ response ->getBody (), true )) {
121
- $ doc = new Document ($ this -> client , $ this -> db_name , $ data );
121
+ $ doc = new Document ($ this , $ data );
122
122
return $ doc ;
123
123
} else {
124
124
throw new Exception \ServerException ('JSON response not received or not understood ' );
0 commit comments