示例#1
0
 public function getUser()
 {
     return $this->hasOne(User::className(), ['id' => 'user_id'])->inverseOf('profile');
 }
示例#2
0
 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']]];
 }
示例#4
0
 public function getCreated()
 {
     return $this->hasOne(User::className(), ['id' => 'createdby']);
 }