diff --git a/UPGRADE-1.3.md b/UPGRADE-1.3.md index e4af17fe9a..0bdd82c6aa 100644 --- a/UPGRADE-1.3.md +++ b/UPGRADE-1.3.md @@ -78,6 +78,13 @@ cause an exception in 2.0. It is possible to have multiple fields with the same name in the database as long as all but one of them have the `notSaved` option set. +## Persisters + + * The `delete` and `update` methods in + `Doctrine\ODM\MongoDB\Persisters\CollectionPersister` are deprecated. Use + `deleteAll` and `updateAll` instead. The method signatures will be adapted + to match those of `deleteAll` and `updateAll` in 2.0. + ## Queries * The `eagerCursor` method in `Doctrine\ODM\MongoDB\Query\Builder` was diff --git a/lib/Doctrine/ODM/MongoDB/Persisters/CollectionPersister.php b/lib/Doctrine/ODM/MongoDB/Persisters/CollectionPersister.php index 31523995a9..899dfc0fcf 100644 --- a/lib/Doctrine/ODM/MongoDB/Persisters/CollectionPersister.php +++ b/lib/Doctrine/ODM/MongoDB/Persisters/CollectionPersister.php @@ -27,6 +27,7 @@ use Doctrine\ODM\MongoDB\UnitOfWork; use Doctrine\ODM\MongoDB\Utility\CollectionHelper; use UnexpectedValueException; +use const E_USER_DEPRECATED; use function array_diff_key; use function array_fill_keys; use function array_flip; @@ -40,8 +41,9 @@ use function get_class; use function implode; use function sort; -use function spl_object_hash; +use function sprintf; use function strpos; +use function trigger_error; /** * The CollectionPersister is responsible for persisting collections of embedded @@ -118,9 +120,13 @@ public function deleteAll($parent, array $collections, array $options) * * @param PersistentCollectionInterface $coll * @param array $options + * + * @deprecated This method will be replaced with the deleteAll method */ public function delete(PersistentCollectionInterface $coll, array $options) { + @trigger_error(sprintf('The "%s" method is deprecated and will be changed to the signature of deleteAll in 2.0.', __METHOD__), E_USER_DEPRECATED); + $mapping = $coll->getMapping(); if ($mapping['isInverseSide']) { return; // ignore inverse side @@ -139,9 +145,13 @@ public function delete(PersistentCollectionInterface $coll, array $options) * * @param PersistentCollectionInterface $coll * @param array $options + * + * @deprecated This method will be replaced with the updateAll method */ public function update(PersistentCollectionInterface $coll, array $options) { + @trigger_error(sprintf('The "%s" method is deprecated and will be changed to the signature of updateAll in 2.0.', __METHOD__), E_USER_DEPRECATED); + $mapping = $coll->getMapping(); if ($mapping['isInverseSide']) {