Update concept-properties.md

This commit is contained in:
杨淇
2017-09-23 16:24:58 +08:00
parent ce2a696c92
commit 7669fa5e14

View File

@ -77,8 +77,8 @@ $object->label = 'abc';
将赋给成员变量而不是 setter `setLabel()` 方法。
* 这类属性不支持可见性(访问限制)。定义属性的 getter 和 setter 方法是 public、protected 还是 private 对属性的可见性没有任何影响。
* 这类属性的 getter 和 setter 方法只能定义为**非静态**的若定义为静态方法static则不会以相同方式处理。
* A normal call to `property_exists()` does not work to determine magic properties. You should call [[yii\base\BaseObject::canGetProperty()|canGetProperty()]]
or [[yii\base\BaseObject::canSetProperty()|canSetProperty()]] respectively.
* 对不确定有无魔术方法getter setter的属性正常调用 `property_exists()` 将不会生效。你应该分别调用 [[yii\base\BaseObject::canGetProperty()|canGetProperty()]]
[[yii\base\BaseObject::canSetProperty()|canSetProperty()]]
回到开头提到的问题,与其处处要调用 `trim()` 函数,
现在我们只需在 setter `setLabel()` 方法内调用一次。