mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-15 05:45:33 +08:00
Fixes #10581: Add note about overriding get/set methods to behaviors guide
This commit is contained in:
committed by
Alexander Makarov
parent
1aee6ddf2a
commit
b87999f6bb
@@ -54,6 +54,9 @@ class MyBehavior extends Behavior
|
||||
> Tip: Внутри поведения возможно обращаться к компоненту, к которому оно прикреплено, используя свойство
|
||||
[[yii\base\Behavior::owner]].
|
||||
|
||||
> Note: Если магический метод [[yii\base\Behavior::__get()]] или [[yii\base\Behavior::__set()]] будет переопределен в
|
||||
унаследованном поведении, то также необходимо переопределить методы [[yii\base\Behavior::canGetProperty()]] и [[yii\base\Behavior::canSetProperty()]]
|
||||
соответственно. Это должно быть сделано для надлежащего функционирования.
|
||||
|
||||
Обработка событий компонента
|
||||
-------------------------
|
||||
|
||||
@@ -50,6 +50,10 @@ Because this class is a behavior, when it is attached to a component, that compo
|
||||
|
||||
> Tip: Within a behavior, you can access the component that the behavior is attached to through the [[yii\base\Behavior::owner]] property.
|
||||
|
||||
> Note: If a magic method of [[yii\base\Behavior::__get()]] or [[yii\base\Behavior::__set()]] has been overridden in a
|
||||
child behavior then need to override [[yii\base\Behavior::canGetProperty()]] and [[yii\base\Behavior::canSetProperty()]]
|
||||
methods respectively too. This must be done to ensure proper functioning.
|
||||
|
||||
Handling Component Events
|
||||
------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user