/**
  * Lists all Diary models.
  * @return mixed
  */
 public function actionList()
 {
     $searchModel = new DiaryRepository();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render(['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 /**
  * @param string $startDate
  * @param string $endDate
  * @return array
  */
 public function findDaysByStartAndEndDate($startDate, $endDate)
 {
     $query = DiaryRepository::getQuery([], false);
     $query->andWhere(['>=', 'date', $startDate])->andWhere(['<=', 'date', $endDate])->orderBy('date')->asArray();
     $userId = $this->findUserId();
     if (!empty($userId)) {
         $query->andWhere(['user_id' => $userId]);
     }
     return $query->all();
 }