@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | if ((int)$res->hits() > 0) { |
| 27 | 27 | $results = json_decode($res->rawResponse())->results; |
| 28 | 28 | $message = $results[0]->{$this->primaryKey} === $this->getPrimaryKeyValue() ? |
| 29 | - 'Primary key collision' : |
|
| 30 | - 'Unique constraint violation'; |
|
| 29 | + 'Primary key collision' : 'Unique constraint violation'; |
|
| 31 | 30 | throw new RestException( |
| 32 | 31 | $message, |
| 33 | 32 | ['resourceName' => $this->resourceName, 'confilct' => $results[0]] |
@@ -44,7 +43,7 @@ discard block |
||
| 44 | 43 | $query->where($this->primaryKey, '!=', $this->getPrimaryKeyValue()); |
| 45 | 44 | } |
| 46 | 45 | // @codeCoverageIgnoreStart |
| 47 | - $query->where(function ($query) use ($uniqueFields) { |
|
| 46 | + $query->where(function($query) use ($uniqueFields) { |
|
| 48 | 47 | foreach ($uniqueFields as $fieldName) { |
| 49 | 48 | if (property_exists($this->resource, $fieldName)) { |
| 50 | 49 | $query->orWhere($fieldName, '==', $this->resource->{$fieldName}); |
@@ -57,7 +56,7 @@ discard block |
||
| 57 | 56 | |
| 58 | 57 | public function query() |
| 59 | 58 | { |
| 60 | - $query = $this->database->getClient()->database($this->database->getDatabaseName().'.'.$this->resourceName); |
|
| 59 | + $query = $this->database->getClient()->database($this->database->getDatabaseName() . '.' . $this->resourceName); |
|
| 61 | 60 | return $query; |
| 62 | 61 | } |
| 63 | 62 | } |