Exemplo n.º 1
0
 /**
  * @return string
  */
 private function renderBodies()
 {
     $result = [];
     $days = array_combine($this->data->getKeys(), $this->data->getModels());
     $lastDate = new DateTime($this->data->getLastDate());
     $p1d = new DateInterval('P1D');
     for ($date = new DateTime($this->data->getFirstDate()); $date <= $lastDate; $date->add($p1d)) {
         $sqlDate = SqlType::encodeDate($date);
         $day = isset($days[$sqlDate]) ? $days[$sqlDate] : ['data' => $sqlDate];
         $zanyatiya = ArrayHelper::getValue($day, 'zanyatiya');
         $result[] = $this->renderDay($day, $zanyatiya);
     }
     return implode("\n", $result);
 }
Exemplo n.º 2
0
 /**
  * @param array $roli
  * @return ActiveQuery
  */
 public static function findByRoli($roli)
 {
     return static::find()->joinWith('polzovateli_rel')->where(['&&', 'polzovatel.roli', SqlType::encodeArraySet($roli)])->groupBy('fiz_lico.id');
 }