Skip to content

Commit 2b5f53e

Browse files
ADmadothercorey
andauthored
Add info about EventManagerInterface::on() signature change. (#8135)
* Add info about EventManagerInterface::on() signature change. Refs cakephp/cakephp#19068 * Apply suggestions from code review Co-authored-by: othercorey <corey.taylor.fl@gmail.com> --------- Co-authored-by: othercorey <corey.taylor.fl@gmail.com>
1 parent 55e8bf8 commit 2b5f53e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

en/appendices/6-0-migration-guide.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ Some methods have also been renamed to better reflect their purpose. These are:
7272
* ``Cake\View\Helper\PaginatorHelper``
7373
- ``_numbers()`` has been renamed to ``buildNumbers()``
7474

75+
Event
76+
-----
77+
78+
- The signature of ``EventManagerInterface::on()`` has changed. The 2nd and 3rd
79+
parameters have been swapped. Calls which pass an options array as the 2nd
80+
argument will need to be updated to pass it as the 3rd argument instead or
81+
use named parameters.
82+
7583
Datasource
7684
----------
7785

en/core-libraries/events.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ for event listeners::
412412
$callback = [$this, 'doSomething'];
413413
$this->getEventManager()->on(
414414
'Order.afterPlace',
415+
$callback,
415416
['priority' => 2],
416-
$callback
417417
);
418418

419419
// Setting priority for a listener

0 commit comments

Comments
 (0)