You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 24, 2020. It is now read-only.
The library provides four strategies out of the box:
684
684
685
-
1.`Zend\Doctrine\Hydrator\Strategy\AllowRemoveByValue`: this is the default strategy, it removes old elements that are not in the new collection.
686
-
2.`Zend\Doctrine\Hydrator\Strategy\AllowRemoveByReference`: this is the default strategy (if set to byReference), it removes old elements that are not in the new collection.
687
-
3.`Zend\Doctrine\Hydrator\Strategy\DisallowRemoveByValue`: this strategy does not remove old elements even if they are not in the new collection.
688
-
4.`Zend\Doctrine\Hydrator\Strategy\DisallowRemoveByReference`: this strategy does not remove old elements even if they are not in the new collection.
685
+
1.`Doctrine\Zend\Hydrator\Strategy\AllowRemoveByValue`: this is the default strategy, it removes old elements that are not in the new collection.
686
+
2.`Doctrine\Zend\Hydrator\Strategy\AllowRemoveByReference`: this is the default strategy (if set to byReference), it removes old elements that are not in the new collection.
687
+
3.`Doctrine\Zend\Hydrator\Strategy\DisallowRemoveByValue`: this strategy does not remove old elements even if they are not in the new collection.
688
+
4.`Doctrine\Zend\Hydrator\Strategy\DisallowRemoveByReference`: this strategy does not remove old elements even if they are not in the new collection.
689
689
690
690
As a consequence, when using `AllowRemove*`, you need to define both adder (eg. addTags) and remover (eg. removeTags).
691
691
On the other hand, when using the `DisallowRemove*` strategy, you must always define at least the adder, but the remover
@@ -708,8 +708,8 @@ remove elements directly from the collection.
708
708
Changing the strategy for collections is plain easy.
709
709
710
710
```php
711
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
712
-
use Zend\Doctrine\Hydrator\Strategy;
711
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
712
+
use Doctrine\Zend\Hydrator\Strategy;
713
713
714
714
$hydrator = new DoctrineHydrator($entityManager);
715
715
$hydrator->addStrategy('tags', new Strategy\DisallowRemoveByValue());
@@ -728,7 +728,7 @@ and hence bypass any logic you may include in your setters/getters).
728
728
To change the behaviour, just give the second parameter of the constructor to false:
729
729
730
730
```php
731
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
731
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
732
732
733
733
$hydrator = new DoctrineHydrator($objectManager, false);
734
734
```
@@ -762,7 +762,7 @@ class SimpleEntity
762
762
Let's now use the hydrator using the default method, by value:
763
763
764
764
```php
765
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
765
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
766
766
767
767
$hydrator = new DoctrineHydrator($objectManager);
768
768
$object = new SimpleEntity();
@@ -778,7 +778,7 @@ As we can see here, the hydrator used the public API (here getFoo) to retrieve t
778
778
However, if we use it by reference:
779
779
780
780
```php
781
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
781
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
782
782
783
783
$hydrator = new DoctrineHydrator($objectManager, false);
784
784
$object = new SimpleEntity();
@@ -964,7 +964,7 @@ namespace Application\Form;
964
964
965
965
use Application\Entity\Tag;
966
966
use Doctrine\Common\Persistence\ObjectManager;
967
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
967
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
968
968
use Zend\Form\Fieldset;
969
969
use Zend\InputFilter\InputFilterProviderInterface;
970
970
@@ -1012,7 +1012,7 @@ namespace Application\Form;
1012
1012
1013
1013
use Application\Entity\BlogPost;
1014
1014
use Doctrine\Common\Persistence\ObjectManager;
1015
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
1015
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
1016
1016
use Zend\Form\Fieldset;
1017
1017
use Zend\InputFilter\InputFilterProviderInterface;
1018
1018
@@ -1068,7 +1068,7 @@ Here is the create form:
1068
1068
namespace Application\Form;
1069
1069
1070
1070
use Doctrine\Common\Persistence\ObjectManager;
1071
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
1071
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
1072
1072
use Zend\Form\Form;
1073
1073
1074
1074
class CreateBlogPostForm extends Form
@@ -1098,7 +1098,7 @@ And the update form:
1098
1098
namespace Application\Form;
1099
1099
1100
1100
use Doctrine\Common\Persistence\ObjectManager;
1101
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
1101
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
1102
1102
use Zend\Form\Form;
1103
1103
1104
1104
class UpdateBlogPostForm extends Form
@@ -1247,7 +1247,7 @@ namespace Application\Form;
1247
1247
1248
1248
use Application\Entity\User;
1249
1249
use Doctrine\Common\Persistence\ObjectManager;
1250
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
1250
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
1251
1251
use Zend\Form\Fieldset;
1252
1252
use Zend\InputFilter\InputFilterProviderInterface;
1253
1253
@@ -1295,7 +1295,7 @@ namespace Application\Form;
1295
1295
1296
1296
use Application\Entity\City;
1297
1297
use Doctrine\Common\Persistence\ObjectManager;
1298
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
1298
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
1299
1299
use Zend\Form\Fieldset;
1300
1300
use Zend\InputFilter\InputFilterProviderInterface;
1301
1301
@@ -1353,7 +1353,7 @@ be like this :
1353
1353
namespace Application\Form;
1354
1354
1355
1355
use Doctrine\Common\Persistence\ObjectManager;
1356
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
1356
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
1357
1357
use Zend\Form\Form;
1358
1358
1359
1359
class EditNameForm extends Form
@@ -1440,7 +1440,7 @@ EditUserForm :
1440
1440
namespace Application\Form;
1441
1441
1442
1442
use Doctrine\Common\Persistence\ObjectManager;
1443
-
use Zend\Doctrine\Hydrator\DoctrineObject as DoctrineHydrator;
1443
+
use Doctrine\Zend\Hydrator\DoctrineObject as DoctrineHydrator;
0 commit comments