Skip to content

Commit 6def0b2

Browse files
committed
1 parent 340a67e commit 6def0b2

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

en/appendices/5-3-migration-guide.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ View
1717
Deprecations
1818
============
1919

20-
TODO
20+
ORM
21+
---
22+
23+
- Calling behavior methods on table instances is now deprecated. To call
24+
a method of an attached behavior you need to use
25+
``$table->getBehavior('Sluggable')->slugify()`` instead of ``$table->slugify()``.
2126

2227
New Features
2328
============

en/orm/behaviors.rst

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,15 @@ Our new behavior doesn't do much of anything right now. Next, we'll add a mixin
8686
method and an event listener so that when we save entities we can automatically
8787
slug a field.
8888

89-
Defining Mixin Methods
90-
----------------------
89+
Calling behavior methods
90+
------------------------
91+
92+
Public methods on behaviors can be called as normal methods::
9193

92-
Any public method defined on a behavior will be added as a 'mixin' method on the
93-
table object it is attached to. If you attach two behaviors that provide the
94+
$articles->getBehavior('Sluggable')->slug($value);
95+
96+
Public methods defined on behaviors are also added as 'mixin' methods on the
97+
table object they are attached to. If you attach two behaviors that provide the
9498
same methods an exception will be raised. If a behavior provides the same method
9599
as a table class, the behavior method will not be callable from the table.
96100
Behavior mixin methods will receive the exact same arguments that are provided
@@ -104,7 +108,10 @@ method::
104108

105109
It could be invoked using::
106110

107-
$slug = $articles->slug('My article name');
111+
$slug = $articles->slug('My article');
112+
113+
.. deprecated:: 5.3.0
114+
Calling behavior methods as mixin methods is deprecated
108115

109116
Limiting or Renaming Exposed Mixin Methods
110117
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)