Exemple #1
0
 /**
  * @param array | string $select поля для выборки
  *                               должны быть возвращены lat, lng, html
  * @return array
  */
 public function getOfficeList($select = null)
 {
     if (is_null($select)) {
         $select = ['point_lat as lat', 'point_lng as lng', 'concat("<h5>",point_address,"</h5>") as html'];
     }
     return Application::cache(self::PREFIX_CACHE_OFFICE_LIST . $this->getId(), function ($options) {
         $query = UnionOffice::query(['union_id' => $options['union_id']]);
         return $query->select($options['select'])->all();
     }, ['select' => $select, 'union_id' => $this->getId()]);
 }
 public function actionIndex($unionId)
 {
     return $this->render(['items' => \app\models\UnionOffice::query(['union_id' => $unionId])->all(), 'union_id' => $unionId]);
 }