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
bug #18677 [DoctrineBridge] Fixed bc layer after #18069 (HeahDude)
This PR was merged into the 3.1-dev branch.
Discussion
----------
[DoctrineBridge] Fixed bc layer after #18069
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | BC break
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Commits
-------
8a6cf9d [DoctrineBridge] fixed bc layer from #18069
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -27,29 +27,32 @@
27
27
*/
28
28
class MergeDoctrineCollectionListener implements EventSubscriberInterface
29
29
{
30
-
// Keeps BC. To be removed in 4.0
30
+
// Keep BC. To be removed in 4.0
31
31
private$bc = true;
32
+
private$bcLayer = false;
32
33
33
34
publicstaticfunctiongetSubscribedEvents()
34
35
{
35
36
// Higher priority than core MergeCollectionListener so that this one
36
37
// is called before
37
38
returnarray(
38
39
FormEvents::SUBMIT => array(
39
-
// BC
40
-
array('onBind', 10),
40
+
array('onBind', 10), // deprecated
41
41
array('onSubmit', 5),
42
42
),
43
43
);
44
44
}
45
45
46
46
publicfunctiononSubmit(FormEvent$event)
47
47
{
48
-
// If onBind() is overridden then logic has been executed
49
48
if ($this->bc) {
49
+
// onBind() has been overridden from a child class
50
50
@trigger_error('The onBind() method is deprecated since version 3.1 and will be removed in 4.0. Use the onSubmit() method instead.', E_USER_DEPRECATED);
51
51
52
-
return;
52
+
if (!$this->bcLayer) {
53
+
// If parent::onBind() has not been called, then logic has been executed
54
+
return;
55
+
}
53
56
}
54
57
55
58
$collection = $event->getForm()->getData();
@@ -68,10 +71,13 @@ public function onSubmit(FormEvent $event)
68
71
* @deprecated since version 3.1, to be removed in 4.0.
0 commit comments