From b5e2a5bbbe0c2682f42d165670e263c06c8a25d1 Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Wed, 23 Mar 2016 21:53:32 +0100 Subject: [PATCH 01/11] Bump docs version --- docs/en/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/en/conf.py b/docs/en/conf.py index f6a0e5a136..563efb3f06 100644 --- a/docs/en/conf.py +++ b/docs/en/conf.py @@ -45,9 +45,9 @@ # built documents. # # The short X.Y version. -version = '1.0' +version = '1.1' # The full version, including alpha/beta/rc tags. -release = '1.0.5' +release = '1.1.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From ed101064285297f3f5f4be3093d2e929381c915d Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Wed, 23 Mar 2016 21:53:48 +0100 Subject: [PATCH 02/11] Changelog draft --- CHANGELOG-1.1.md | 65 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index eae437510a..6db1e3a392 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -1,11 +1,70 @@ CHANGELOG for 1.1.x =================== -This changelog references the relevant changes done in 1.1 minor versions. +This changelog references the relevant changes done in 1.1 minor versions. If upgrading from +1.0.x branch, please review +[Upgrade Path](https://github.com/doctrine/mongodb-odm/blob/master/CHANGELOG-1.1.md#upgrade-path). -1.1.x-dev ---------- +1.1.0 +----- + +All issues and pull requests in this release may be found under the +[1.1.0 milestone](https://github.com/doctrine/mongodb-odm/issues?q=milestone%3A1.1.0). + +#### Sharding support + +https://github.com/doctrine/mongodb-odm/pull/1385 + +#### Custom Collections + +https://github.com/doctrine/mongodb-odm/pull/1219 + +#### Event is dispatched for missing referenced documents + +https://github.com/doctrine/mongodb-odm/pull/1336 + +#### Partial indexes + +https://github.com/doctrine/mongodb-odm/pull/1303 + +#### More powerful lifecycle callbacks + +https://github.com/doctrine/mongodb-odm/pull/1222 + +#### Ease using objects as search criterion + +https://github.com/doctrine/mongodb-odm/pull/1363 +https://github.com/doctrine/mongodb-odm/pull/1333 + +#### EmbedMany and ReferenceMany fields included in the change set + +https://github.com/doctrine/mongodb-odm/pull/1339 + +PHP 7 compatibility +------------------- + +@todo + +Upgrade Path +------------ #### PHP requirement changed PHP 5.3 and 5.4 support has been dropped due to their [end of life](http://php.net/eol.php). + +#### preLoad lifecycle callback signature change + +`preLoad` lifecycle callback now receives `PreLoadEventArgs` object instead of an array of data +passed by reference. For reasoning why the change was made please see relevant pull request +([#1222](https://github.com/doctrine/mongodb-odm/pull/1222)). + +Deprecations +------------ + +#### `@Field` preferred way of mapping field + +@todo + +#### `@Increment` superseded by storage strategies + +@todo From c62133165798912badbf153fe3ccb9a7bc0990bb Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Mon, 23 May 2016 21:23:30 +0200 Subject: [PATCH 03/11] Add Read-Only fetch mode to changelog --- CHANGELOG-1.1.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index 6db1e3a392..e2ec9c10a4 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -36,6 +36,10 @@ https://github.com/doctrine/mongodb-odm/pull/1222 https://github.com/doctrine/mongodb-odm/pull/1363 https://github.com/doctrine/mongodb-odm/pull/1333 +#### Read-Only mode for fetching documents + +https://github.com/doctrine/mongodb-odm/pull/1403 + #### EmbedMany and ReferenceMany fields included in the change set https://github.com/doctrine/mongodb-odm/pull/1339 From 05d02a72d79278e95d497e76ce9c1a441b71e805 Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Mon, 23 May 2016 21:32:08 +0200 Subject: [PATCH 04/11] Bump PHP requirement to 5.6 --- .travis.yml | 1 - composer.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf40ebf32f..9a02e365f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.5 - 5.6 env: diff --git a/composer.json b/composer.json index c22b6746a0..39cc438fa1 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ { "name": "Andreas Braun", "email": "alcaeus@alcaeus.org" } ], "require": { - "php": "^5.5 || ^7.0", + "php": "^5.6 || ^7.0", "symfony/console": "~2.3|~3.0", "doctrine/annotations": "~1.0", "doctrine/collections": "~1.1", From 1daeb43d0fe966d157ca6e39e0ef1628e7f6011d Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Mon, 23 May 2016 21:45:09 +0200 Subject: [PATCH 05/11] PHP 5.5 drop and 1.0.x EOL --- CHANGELOG-1.1.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index e2ec9c10a4..4702d3b063 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -54,7 +54,8 @@ Upgrade Path #### PHP requirement changed -PHP 5.3 and 5.4 support has been dropped due to their [end of life](http://php.net/eol.php). +PHP 5.3, 5.4 and 5.5 support has been dropped due to their [end of life](http://php.net/eol.php) +(or getting close to it in case of 5.5). #### preLoad lifecycle callback signature change @@ -72,3 +73,10 @@ Deprecations #### `@Increment` superseded by storage strategies @todo + +1.0.x End-of-Life +----------------- + +ODM 1.1 drops older PHP versions which may be problematic for some users. Although we strongly +recommend running latest PHP we understand this may not be easy change therefore we will still +support ODM 1.0.x and release bugfix versions for **6 months** from now on. From 3fd2c46e1b691dab96717febb9997f92be63c181 Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Mon, 23 May 2016 22:02:50 +0200 Subject: [PATCH 06/11] Deprecations --- CHANGELOG-1.1.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index 4702d3b063..132258c372 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -68,11 +68,17 @@ Deprecations #### `@Field` preferred way of mapping field -@todo +Due to PHP 7 reserving keywords such as `int`, `string`, `bool` and `float` their respective +field annotations are no longer valid. To avoid having large inconsistencies +[#1318](https://github.com/doctrine/mongodb-odm/pull/1318) deprecates all annotations which +only purpose was setting mapped field's type. Deprecated classes will be removed in version 2.0. #### `@Increment` superseded by storage strategies -@todo +[#1352](https://github.com/doctrine/mongodb-odm/pull/1352) deprecates `@Increment` field type +in favour of more robust `strategy` field option. To learn more about storage strategies +please see relevant chapter in [documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/storage-strategies.html). +`increment` field type will be removed in version 2.0. 1.0.x End-of-Life ----------------- From 26ce957c9118733d96be5661454a46e669de1733 Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Mon, 23 May 2016 22:12:58 +0200 Subject: [PATCH 07/11] PHP 7 compatibility --- CHANGELOG-1.1.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index 132258c372..a6f07f50b6 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -47,7 +47,12 @@ https://github.com/doctrine/mongodb-odm/pull/1339 PHP 7 compatibility ------------------- -@todo +While ODM still relies on legacy MongoDB driver (i.e. [ext-mongo](https://pecl.php.net/package/mongo)) +it is possible to run ODM using PHP 7 and HHVM thanks to +[alcaeus/mongo-php-adapter](https://github.com/alcaeus/mongo-php-adapter) which provides old API +atop new [ext-mongodb](http://php.net/manual/en/mongodb.installation.php) driver and +[mongodb/mongo-php-library](https://github.com/mongodb/mongo-php-library) library. Until ODM 2.0 is +released this is officially supported way and is included in our test suite. Upgrade Path ------------ From 2fca7902cf1c4e454052502364a6fb137a088cb8 Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Mon, 23 May 2016 23:30:08 +0200 Subject: [PATCH 08/11] Filled in features overview --- CHANGELOG-1.1.md | 60 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index a6f07f50b6..4bdc9b82f6 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -13,36 +13,78 @@ All issues and pull requests in this release may be found under the #### Sharding support -https://github.com/doctrine/mongodb-odm/pull/1385 +[#1385](https://github.com/doctrine/mongodb-odm/pull/1385) - +Introduces full [sharding](https://docs.mongodb.com/manual/sharding/) support for ODM. +For usage instructions please refer to +[Sharding chapter](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/sharding.html) +in the documentation. #### Custom Collections -https://github.com/doctrine/mongodb-odm/pull/1219 +[#1219](https://github.com/doctrine/mongodb-odm/pull/1219) - +Allows developer to use their own collection classes instead of `ArrayCollection` for +`@EmbedMany` and `@ReferenceMany` fields and gives full control on how the collections +are instantiated. For full usage reference please check out +[Custom Collections chapter](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/custom-collections.html) +in the documentation. #### Event is dispatched for missing referenced documents -https://github.com/doctrine/mongodb-odm/pull/1336 +[#1336](https://github.com/doctrine/mongodb-odm/pull/1336) - +When referenced document is accessed but not found in database ODM throws +`DocumentNotFoundException` exception. As of now user can hook into the process +and populate incomplete object on his/her own or take any other suitable action. +For example usage please refer to +[documentNotFound event documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/events.html#documentnotfound). #### Partial indexes -https://github.com/doctrine/mongodb-odm/pull/1303 +[#1303](https://github.com/doctrine/mongodb-odm/pull/1303) +Partial indexes [introduced in MongoDB 3.2](https://docs.mongodb.com/manual/core/index-partial/) +are also supported as ODM's `@Index` option. + +@todo docs are barely mentioning partialFilterExpression, should we add examples? #### More powerful lifecycle callbacks -https://github.com/doctrine/mongodb-odm/pull/1222 +[#1222](https://github.com/doctrine/mongodb-odm/pull/1222) - +Document's lifecycle callbacks are now receiving an event argument which allows user +to access `DocumentManager` should (s)he need it. For full method signatures please see +[Event chapter](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/events.html#lifecycle-callbacks) +of documentation. #### Ease using objects as search criterion -https://github.com/doctrine/mongodb-odm/pull/1363 -https://github.com/doctrine/mongodb-odm/pull/1333 +[#1363](https://github.com/doctrine/mongodb-odm/pull/1363) - +querying for references is now less tedious, now you can use + +``` +$dm->getRepository(User::class)->findOneBy(['account' => $account]); +$dm->getRepository(User::class)->findBy(['groups' => $group]); +``` + +[#1333](https://github.com/doctrine/mongodb-odm/pull/1333) - +ODM will go through known class' descendants when query builder's `references` or +`includesReferenceTo` are used with non-existing field (i.e. discriminated abstract +class being queried for references defined in child classes). #### Read-Only mode for fetching documents -https://github.com/doctrine/mongodb-odm/pull/1403 +[#1403](https://github.com/doctrine/mongodb-odm/pull/1403) - +Read-Only mode instructs ODM to not only hydrate the latest data but also to +create new document's instance (i.e. if found document would be already managed +by Doctrine, new instance will be returned) and not register it in UnitOfWork`. +This technique can prove especially useful when using `select()` while building +query with no intent to update fetched documents. To read more about read-only mode +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). #### EmbedMany and ReferenceMany fields included in the change set -https://github.com/doctrine/mongodb-odm/pull/1339 +[#1339](https://github.com/doctrine/mongodb-odm/pull/1339) - +Previously hard to spot changes in collections are now easier to detect thanks to +including them in the owning document's change set. While collections' instances +are usually the same you can check both new and removed documents with `getInsertedDocuments` +and `getDeletedDocuments` methods respectively. PHP 7 compatibility ------------------- From 30285e4ba603ad6e2a28ddf26f193e4b58adc08c Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 31 May 2016 11:31:55 +0200 Subject: [PATCH 09/11] Update changelog --- CHANGELOG-1.1.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index 4bdc9b82f6..8cd7734c08 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -41,9 +41,8 @@ For example usage please refer to [#1303](https://github.com/doctrine/mongodb-odm/pull/1303) Partial indexes [introduced in MongoDB 3.2](https://docs.mongodb.com/manual/core/index-partial/) -are also supported as ODM's `@Index` option. - -@todo docs are barely mentioning partialFilterExpression, should we add examples? +are also supported as ODM's `@Index` option. For example usage please refer to +[index documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/indexes.html#partial-indexes) #### More powerful lifecycle callbacks @@ -86,6 +85,12 @@ including them in the owning document's change set. While collections' instances are usually the same you can check both new and removed documents with `getInsertedDocuments` and `getDeletedDocuments` methods respectively. +#### Support for immutable DateTime objects + +[#1391](https://github.com/doctrine/mongodb-odm/pull/1391) - +The `Date` type now supports converting `DateTimeImmutable` objects to `MongoDate`. Previously, only +`DateTime` was converted, causing errors when using immutable date objects. + PHP 7 compatibility ------------------- @@ -94,7 +99,9 @@ it is possible to run ODM using PHP 7 and HHVM thanks to [alcaeus/mongo-php-adapter](https://github.com/alcaeus/mongo-php-adapter) which provides old API atop new [ext-mongodb](http://php.net/manual/en/mongodb.installation.php) driver and [mongodb/mongo-php-library](https://github.com/mongodb/mongo-php-library) library. Until ODM 2.0 is -released this is officially supported way and is included in our test suite. +released this is officially supported way and is included in our test suite. If you are using +annotations to map documents, do not use the deprecated annotations mentioned below as they do not +work in PHP 7. Upgrade Path ------------ @@ -127,6 +134,15 @@ in favour of more robust `strategy` field option. To learn more about storage st please see relevant chapter in [documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/storage-strategies.html). `increment` field type will be removed in version 2.0. +#### `Simple` references superseded by `storeAs` + +[#1349](https://github.com/doctrine/mongodb-odm/pull/1349) deprecates the `simple` option used +in references and replaces it with the new `storeAs` option. This allows for an additional reference +mode called `dbRef` which doesn't store a `$db` field in the `DBRef` object. For compatibility with +existing references, the default mode is `dbRefWithDb` but will be replaced with `dbRef` in version +2.0. For more information, see the +[reference mapping documentation](http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/reference-mapping.html#storing-references). + 1.0.x End-of-Life ----------------- From 73eaf21648c213a3ba1308b5114d82040c3f8fc0 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 2 Jun 2016 14:49:45 +0200 Subject: [PATCH 10/11] Add changelog entry for #1419 --- CHANGELOG-1.1.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index 8cd7734c08..29f9fc0a4c 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -91,6 +91,13 @@ and `getDeletedDocuments` methods respectively. The `Date` type now supports converting `DateTimeImmutable` objects to `MongoDate`. Previously, only `DateTime` was converted, causing errors when using immutable date objects. +#### Support for writeConcern per document + +[#1419](https://github.com/doctrine/mongodb-odm/pull/1419) - +The new `writeConcern` property in the document mapping allows users to overwrite the default write +concern specified in the configuration. With this, it's possible to allow unacknowledged writes for +certain documents or require writes to more than one node for others. + PHP 7 compatibility ------------------- From 73c24dcee8ddc0210e5922bc1d1f57918bae9ca2 Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Thu, 9 Jun 2016 15:58:05 +0200 Subject: [PATCH 11/11] Add missing backtick --- CHANGELOG-1.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index 29f9fc0a4c..4ac107719a 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -72,7 +72,7 @@ class being queried for references defined in child classes). [#1403](https://github.com/doctrine/mongodb-odm/pull/1403) - Read-Only mode instructs ODM to not only hydrate the latest data but also to create new document's instance (i.e. if found document would be already managed -by Doctrine, new instance will be returned) and not register it in UnitOfWork`. +by Doctrine, new instance will be returned) and not register it in `UnitOfWork`. This technique can prove especially useful when using `select()` while building query with no intent to update fetched documents. To read more about read-only mode 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).