/** * @param string $name * @return mixed * @throws \yii\base\UnknownPropertyException */ public function __get($name) { if (parent::hasProperty($name)) { return parent::__get($name); } return $this->db->{$name}; }
/** * @param \yii\base\Model $model * * @param string $attribute */ public function validateAttribute($model, $attribute) { $serviceList = $this->getSynchonizer()->getServiceList(); if ($model->hasProperty($attribute)) { if (!is_array($model->{$attribute})) { $this->addError($model, $attribute, Yii::t('SyncSocial', 'Attribute "{attribute}" must be array', ['attribute' => $attribute])); } else { foreach ($model->{$attribute} as $service) { if (!in_array($service, $serviceList)) { $this->addError($model, $attribute, Yii::t('SyncSocial', 'Service list has wrong value')); } } } } }