|
1 | 1 | CHANGELOG for 1.1.x
|
2 | 2 | ===================
|
3 | 3 |
|
4 |
| -This changelog references the relevant changes done in 1.1 minor versions. |
| 4 | +This changelog references the relevant changes done in 1.1 minor versions. If upgrading from |
| 5 | +1.0.x branch, please review |
| 6 | +[Upgrade Path](https://github.com/doctrine/mongodb-odm/blob/master/CHANGELOG-1.1.md#upgrade-path). |
5 | 7 |
|
6 |
| -1.1.x-dev |
7 |
| ---------- |
| 8 | +1.1.0 |
| 9 | +----- |
| 10 | + |
| 11 | +All issues and pull requests in this release may be found under the |
| 12 | +[1.1.0 milestone](https://github.com/doctrine/mongodb-odm/issues?q=milestone%3A1.1.0). |
| 13 | + |
| 14 | +#### Sharding support |
| 15 | + |
| 16 | +[#1385](https://github.com/doctrine/mongodb-odm/pull/1385) - |
| 17 | +Introduces full [sharding](https://docs.mongodb.com/manual/sharding/) support for ODM. |
| 18 | +For usage instructions please refer to |
| 19 | +[Sharding chapter](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/sharding.html) |
| 20 | +in the documentation. |
| 21 | + |
| 22 | +#### Custom Collections |
| 23 | + |
| 24 | +[#1219](https://github.com/doctrine/mongodb-odm/pull/1219) - |
| 25 | +Allows developer to use their own collection classes instead of `ArrayCollection` for |
| 26 | +`@EmbedMany` and `@ReferenceMany` fields and gives full control on how the collections |
| 27 | +are instantiated. For full usage reference please check out |
| 28 | +[Custom Collections chapter](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/custom-collections.html) |
| 29 | +in the documentation. |
| 30 | + |
| 31 | +#### Event is dispatched for missing referenced documents |
| 32 | + |
| 33 | +[#1336](https://github.com/doctrine/mongodb-odm/pull/1336) - |
| 34 | +When referenced document is accessed but not found in database ODM throws |
| 35 | +`DocumentNotFoundException` exception. As of now user can hook into the process |
| 36 | +and populate incomplete object on his/her own or take any other suitable action. |
| 37 | +For example usage please refer to |
| 38 | +[documentNotFound event documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/events.html#documentnotfound). |
| 39 | + |
| 40 | +#### Partial indexes |
| 41 | + |
| 42 | +[#1303](https://github.com/doctrine/mongodb-odm/pull/1303) |
| 43 | +Partial indexes [introduced in MongoDB 3.2](https://docs.mongodb.com/manual/core/index-partial/) |
| 44 | +are also supported as ODM's `@Index` option. For example usage please refer to |
| 45 | +[index documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/indexes.html#partial-indexes) |
| 46 | + |
| 47 | +#### More powerful lifecycle callbacks |
| 48 | + |
| 49 | +[#1222](https://github.com/doctrine/mongodb-odm/pull/1222) - |
| 50 | +Document's lifecycle callbacks are now receiving an event argument which allows user |
| 51 | +to access `DocumentManager` should (s)he need it. For full method signatures please see |
| 52 | +[Event chapter](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/events.html#lifecycle-callbacks) |
| 53 | +of documentation. |
| 54 | + |
| 55 | +#### Ease using objects as search criterion |
| 56 | + |
| 57 | +[#1363](https://github.com/doctrine/mongodb-odm/pull/1363) - |
| 58 | +querying for references is now less tedious, now you can use |
| 59 | + |
| 60 | +``` |
| 61 | +$dm->getRepository(User::class)->findOneBy(['account' => $account]); |
| 62 | +$dm->getRepository(User::class)->findBy(['groups' => $group]); |
| 63 | +``` |
| 64 | + |
| 65 | +[#1333](https://github.com/doctrine/mongodb-odm/pull/1333) - |
| 66 | +ODM will go through known class' descendants when query builder's `references` or |
| 67 | +`includesReferenceTo` are used with non-existing field (i.e. discriminated abstract |
| 68 | +class being queried for references defined in child classes). |
| 69 | + |
| 70 | +#### Read-Only mode for fetching documents |
| 71 | + |
| 72 | +[#1403](https://github.com/doctrine/mongodb-odm/pull/1403) - |
| 73 | +Read-Only mode instructs ODM to not only hydrate the latest data but also to |
| 74 | +create new document's instance (i.e. if found document would be already managed |
| 75 | +by Doctrine, new instance will be returned) and not register it in `UnitOfWork`. |
| 76 | +This technique can prove especially useful when using `select()` while building |
| 77 | +query with no intent to update fetched documents. To read more about read-only mode |
| 78 | +you can check [documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/query-builder-api.html#fetching-documents-as-read-only). |
| 79 | + |
| 80 | +#### EmbedMany and ReferenceMany fields included in the change set |
| 81 | + |
| 82 | +[#1339](https://github.com/doctrine/mongodb-odm/pull/1339) - |
| 83 | +Previously hard to spot changes in collections are now easier to detect thanks to |
| 84 | +including them in the owning document's change set. While collections' instances |
| 85 | +are usually the same you can check both new and removed documents with `getInsertedDocuments` |
| 86 | +and `getDeletedDocuments` methods respectively. |
| 87 | + |
| 88 | +#### Support for immutable DateTime objects |
| 89 | + |
| 90 | +[#1391](https://github.com/doctrine/mongodb-odm/pull/1391) - |
| 91 | +The `Date` type now supports converting `DateTimeImmutable` objects to `MongoDate`. Previously, only |
| 92 | +`DateTime` was converted, causing errors when using immutable date objects. |
| 93 | + |
| 94 | +#### Support for writeConcern per document |
| 95 | + |
| 96 | +[#1419](https://github.com/doctrine/mongodb-odm/pull/1419) - |
| 97 | +The new `writeConcern` property in the document mapping allows users to overwrite the default write |
| 98 | +concern specified in the configuration. With this, it's possible to allow unacknowledged writes for |
| 99 | +certain documents or require writes to more than one node for others. |
| 100 | + |
| 101 | +PHP 7 compatibility |
| 102 | +------------------- |
| 103 | + |
| 104 | +While ODM still relies on legacy MongoDB driver (i.e. [ext-mongo](https://pecl.php.net/package/mongo)) |
| 105 | +it is possible to run ODM using PHP 7 and HHVM thanks to |
| 106 | +[alcaeus/mongo-php-adapter](https://github.com/alcaeus/mongo-php-adapter) which provides old API |
| 107 | +atop new [ext-mongodb](http://php.net/manual/en/mongodb.installation.php) driver and |
| 108 | +[mongodb/mongo-php-library](https://github.com/mongodb/mongo-php-library) library. Until ODM 2.0 is |
| 109 | +released this is officially supported way and is included in our test suite. If you are using |
| 110 | +annotations to map documents, do not use the deprecated annotations mentioned below as they do not |
| 111 | +work in PHP 7. |
| 112 | + |
| 113 | +Upgrade Path |
| 114 | +------------ |
8 | 115 |
|
9 | 116 | #### PHP requirement changed
|
10 | 117 |
|
11 |
| -PHP 5.3 and 5.4 support has been dropped due to their [end of life](http://php.net/eol.php). |
| 118 | +PHP 5.3, 5.4 and 5.5 support has been dropped due to their [end of life](http://php.net/eol.php) |
| 119 | +(or getting close to it in case of 5.5). |
| 120 | + |
| 121 | +#### preLoad lifecycle callback signature change |
| 122 | + |
| 123 | +`preLoad` lifecycle callback now receives `PreLoadEventArgs` object instead of an array of data |
| 124 | +passed by reference. For reasoning why the change was made please see relevant pull request |
| 125 | +([#1222](https://github.com/doctrine/mongodb-odm/pull/1222)). |
| 126 | + |
| 127 | +Deprecations |
| 128 | +------------ |
| 129 | + |
| 130 | +#### `@Field` preferred way of mapping field |
| 131 | + |
| 132 | +Due to PHP 7 reserving keywords such as `int`, `string`, `bool` and `float` their respective |
| 133 | +field annotations are no longer valid. To avoid having large inconsistencies |
| 134 | +[#1318](https://github.com/doctrine/mongodb-odm/pull/1318) deprecates all annotations which |
| 135 | +only purpose was setting mapped field's type. Deprecated classes will be removed in version 2.0. |
| 136 | + |
| 137 | +#### `@Increment` superseded by storage strategies |
| 138 | + |
| 139 | +[#1352](https://github.com/doctrine/mongodb-odm/pull/1352) deprecates `@Increment` field type |
| 140 | +in favour of more robust `strategy` field option. To learn more about storage strategies |
| 141 | +please see relevant chapter in [documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/storage-strategies.html). |
| 142 | +`increment` field type will be removed in version 2.0. |
| 143 | + |
| 144 | +#### `Simple` references superseded by `storeAs` |
| 145 | + |
| 146 | +[#1349](https://github.com/doctrine/mongodb-odm/pull/1349) deprecates the `simple` option used |
| 147 | +in references and replaces it with the new `storeAs` option. This allows for an additional reference |
| 148 | +mode called `dbRef` which doesn't store a `$db` field in the `DBRef` object. For compatibility with |
| 149 | +existing references, the default mode is `dbRefWithDb` but will be replaced with `dbRef` in version |
| 150 | +2.0. For more information, see the |
| 151 | +[reference mapping documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/reference-mapping.html#storing-references). |
| 152 | + |
| 153 | +1.0.x End-of-Life |
| 154 | +----------------- |
| 155 | + |
| 156 | +ODM 1.1 drops older PHP versions which may be problematic for some users. Although we strongly |
| 157 | +recommend running latest PHP we understand this may not be easy change therefore we will still |
| 158 | +support ODM 1.0.x and release bugfix versions for **6 months** from now on. |
0 commit comments