|
2 | 2 |
|
3 | 3 | This document outlines the key breaking changes introduced in version 2 of the google-cloud-php Firestore library and provides guidance on how to update your code. |
4 | 4 |
|
5 | | -## 1. Removal of the `Connection` Layer |
| 5 | +## 1. Client Options changes |
| 6 | + |
| 7 | +The following client options are removed/replaced with other options present in |
| 8 | +[`ClientOptions`][ClientOptions]. This was done to ensure client options are consistent across all |
| 9 | +Google Cloud clients. |
| 10 | + |
| 11 | +- `authCache` -> Moved to `credentialsConfig.authCache` |
| 12 | +- `authCacheOptions` -> Moved to `credentialsConfig.authCacheOptions` |
| 13 | +- `credentialsFetcher` -> Moved to `credentials` |
| 14 | +- `keyFile` -> Moved to `credentials` |
| 15 | +- `keyFilePath` -> Moved to `credentials` |
| 16 | +- `scopes` -> Moved to `credentialsConfig.scopes` |
| 17 | +- `quotaProject` -> Moved to `credentialsConfig.quotaProject` |
| 18 | +- `httpHandler` -> Moved to `transportConfig.rest.httpHandler` |
| 19 | +- `authHttpHandler` -> Moved to `credentialsConfig.authHttpHandler` |
| 20 | + |
| 21 | +## 2. Removal of the `Connection` Layer |
6 | 22 |
|
7 | 23 | The most significant change in v2 is the removal of the `ConnectionInterface` and its `Grpc` implementation. All classes that previously depended on the connection layer now interact directly with the auto generated client for Firestore (`Google\Cloud\Firestore\V1\Client\FirestoreClient`). |
8 | 24 |
|
9 | 25 | This change simplifies the library's architecture but requires updates to how you instantiate several core classes. |
10 | 26 |
|
11 | | -## 2. Constructor Changes |
| 27 | +**Note**: If you primarily use factory methods (e.g. `$firestore->collection(...)`, `$collection->document(...)`), your |
| 28 | +code likely requires no changes, as the library handles these dependencies internally. |
| 29 | + |
| 30 | +## 3. Constructor Changes |
12 | 31 |
|
13 | 32 | Due to the removal of the `Connection` layer, the constructors for the following classes have changed. They no longer accept a `ConnectionInterface` instance and instead require a `Google\Cloud\Firestore\V1\Client\FirestoreClient` instance. |
14 | 33 |
|
@@ -58,7 +77,7 @@ $docRef = new DocumentReference( |
58 | 77 |
|
59 | 78 | You will need to apply similar changes wherever you instantiate the classes listed above. The main `FirestoreClient` will now manage the GAPIC client instance. |
60 | 79 |
|
61 | | -## 3. `WriteBatch` Class Removed |
| 80 | +## 4. `WriteBatch` Class Removed |
62 | 81 |
|
63 | 82 | The `WriteBatch` class, which was previously a deprecated alias for `BulkWriter`, has been completely removed. |
64 | 83 |
|
|
0 commit comments