CHANGELOG for 1.1.x
This changelog references the relevant changes done in 1.1 minor versions. If upgrading from 1.0.x branch, please review Upgrade Path.
All issues and pull requests in this release may be found under the 1.1.3 milestone.
- #1551 fixes modifying reference fields with Query Builder
- #1550 fixes reusing embedded documents with multiple flushes
- #1543 provides support for nullable return types in custom collections
- #1540 ensures compatibility with MongoDB 3.4
- #1544 ensures compatibility with PHP 7.1
All issues and pull requests in this release may be found under the 1.1.2 milestone.
- #1468 fixes dropping of GridFS collections when calling
dropCollections()on the SchemaManager
- #1481 fixes preparation of referenced objects when using
- #1498 fixes orphanRemoval when clearing an uninitialized collection
- #1503 fixes an error with
createDbRefnot working for objects with an ID that evaluated to false (e.g. empty string, 0)
All issues and pull requests in this release may be found under the 1.1.1 milestone.
- #1436 ensures generated Documents/Repositories follow PSR-2 coding standard
- #1437 fixes change set of exchanged collection to include old one
- #1440 fixes upserting documents mapped with YAML file
- #1458 adds support for
customCollectionto XML/YAML drivers
- #1461 fixes overwriting data of documents contained in sorted collection
- #1462 makes PersistentCollection call decorated
- #1466 fixes hydrating
nullvalue when field is nullable
All issues and pull requests in this release may be found under the 1.1.0 milestone.
Allows developer to use their own collection classes instead of
@ReferenceMany fields and gives full control on how the collections
are instantiated. For full usage reference please check out
Custom Collections chapter
in the documentation.
Event is dispatched for missing referenced documents
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.
More powerful lifecycle callbacks
Document's lifecycle callbacks are now receiving an event argument which allows user
DocumentManager should (s)he need it. For full method signatures please see
Ease using objects as search criterion
#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]);
ODM will go through known class' descendants when query builder's
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
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
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.
EmbedMany and ReferenceMany fields included in the change set
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
getDeletedDocuments methods respectively.
Support for immutable DateTime objects
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
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
While ODM still relies on legacy MongoDB driver (i.e. ext-mongo) it is possible to run ODM using PHP 7 and HHVM thanks to alcaeus/mongo-php-adapter which provides old API atop new ext-mongodb driver and mongodb/mongo-php-library library. Until ODM 2.0 is 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.
PHP requirement changed
PHP 5.3, 5.4 and 5.5 support has been dropped due to their end of life (or getting close to it in case of 5.5).
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
@Field preferred way of mapping field
Due to PHP 7 reserving keywords such as
float their respective
field annotations are no longer valid. To avoid having large inconsistencies
#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
@Increment field type
in favour of more robust
strategy field option. To learn more about storage strategies
please see relevant chapter in documentation.
increment field type will be removed in version 2.0.
Simple references superseded by
#1349 deprecates the
simple option used
in references and replaces it with the new
storeAs option. This allows for an additional reference
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.
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.