yii\db\BaseActiveRecord::hasAttribute PHP Метод

hasAttribute() публичный Метод

Returns a value indicating whether the model has an attribute with the specified name.
public hasAttribute ( string $name ) : boolean
$name string the name of the attribute
Результат boolean whether the model has an attribute with the specified name.
    public function hasAttribute($name)
    {
        return isset($this->_attributes[$name]) || in_array($name, $this->attributes(), true);
    }

Usage Example

 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if ($this->_relation->hasAttribute($name) || $this->_relation->canGetProperty($name)) {
         $this->_relation->{$name} = $value;
     } else {
         parent::__set($name, $value);
     }
 }
All Usage Examples Of yii\db\BaseActiveRecord::hasAttribute