yii2 +在ActiveDataProvider中加入查询

时间:2015-09-14 10:15:56

标签: php yii2 yii2-user

这是我的实际查询 -

data<-data.frame(DOB=c('12/12/01', '8/05/80', '2/11/99'), 
                 started =c('5/10/10', '4/01/12', '27/08/11'))

library(stringr)
toFourYear <- function(x){
  x <- str_split(x, "/")
  x <- lapply(x,
         function(t){
            t[3] <- if (as.numeric(t[3]) < 15) paste0("20", t[3]) else paste0("19", t[3])
           t
         })    
  x <- vapply(x, paste0, character(1), collapse = "/")
  x
}

data$DOB <- toFourYear(data$DOB)
data$started <- toFourYear(data$started)

&#39;的状态&#39;字段存在于用户表中。所以我想按状态!= 0 过滤数据但是失败了。

我试过了 -

1

$dataProvider = new ActiveDataProvider([
            'query' => UserProfile::find()->with(['user'])
        ]);

2

$dataProvider = new ActiveDataProvider([
            'query' => UserProfile::find()->with(['user'])->where('user.status !=',0)
        ]);

它都不起作用。请告诉我它是如何可能的?

0 个答案:

没有答案