public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id'])->inverseOf('profile'); }
public function getAuthor() { return $this->hasOne(User::className(), ['id' => 'user_id']); }
/** * @inheritdoc */ public function rules() { return [[['user_id'], 'required'], [['user_id'], 'integer'], [['phone', 'site', 'description'], 'string'], ['description', 'string', 'length' => [6, 2048]], ['phone', 'match', 'pattern' => '/^((8|\\+7)[\\- ]?)?(\\(?\\d{3}\\)?[\\- ]?)?[\\d\\- ]{7,10}$/', 'message' => Yii::t('users', 'Неправильный формат телефона')], ['site', 'url', 'defaultScheme' => 'http'], ['birthday', 'date'], [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']]]; }
public function getCreated() { return $this->hasOne(User::className(), ['id' => 'createdby']); }