public function actionGetDataForFillForm()
 {
     if (Yii::app()->user->checkAccess('avtopark')) {
         $transport_id = (int) Yii::app()->request->getPost('id');
         // получить массив полей формы
         $data = Yii::app()->request->getPost('data');
         if (is_array($data) && count($data)) {
             // проверить что транспорт принадлежить компании
             $company_id = Yii::app()->getUser()->getProfile()->company_id;
             $arrTmp = [];
             foreach ($data as $v) {
                 if (!isset($arrTmp[$v['name']])) {
                     $arrTmp[$v['name']] = $v['value'];
                 } else {
                     Yii::log("actionGetDataForFillForm data already have key=[{$v['name']}]", "info");
                 }
             }
             $Transport = Transport::model();
             $TransportItem = $Transport->findByPk($transport_id);
             if (!is_null($TransportItem)) {
                 $arrRel = $Transport->relations();
                 $arrRelData = [];
                 foreach ($Transport->getRelationList() as $vrel) {
                     // данные из других таблиц брать по getRelationList
                     if (isset($arrRel[$vrel])) {
                         $resTmp = $TransportItem->{$vrel};
                         if (is_array($resTmp)) {
                             $arrRelData[$vrel] = [];
                             foreach ($resTmp as $vrelItem) {
                                 $arrRelData[$vrel][] = $vrelItem->getPrimaryKey();
                             }
                         } else {
                             $arrRelData[$vrel] = $resTmp->getPrimaryKey();
                         }
                     }
                 }
                 $criteria = new CDbCriteria();
                 $criteria->addCondition("t.transport_id=:transport_id");
                 $criteria->with = ['user' => ['joinType' => 'INNER JOIN', 'condition' => 'user.company_id = :company_id']];
                 $criteria->params = [':company_id' => $company_id, ':transport_id' => $transport_id];
                 $transportItemTmp = $Transport->find($criteria);
                 if (!is_null($transportItemTmp)) {
                     $transportItem = $transportItemTmp->attributes;
                     $transportItem['transport_type_id'] = Reis::getReplaceMyTransportTypeToReis($transportItem['type_id']);
                     unset($transportItem['type_id']);
                     unset($transportItem['notice']);
                     unset($transportItem['create']);
                     unset($transportItem['update']);
                     // надо вернуть массив с ключ-значение, которое будет проставленно в форму
                     foreach ($arrTmp as $k => $v) {
                         $kTmp = preg_replace('/^(Reis\\[)(.+?)(\\])$/ui', '$2', $k);
                         if (array_key_exists($kTmp, $transportItem)) {
                             $arrTmp[$k] = $transportItem[$kTmp];
                         } else {
                             if (isset($arrRelData[$kTmp])) {
                                 // видимо данные из relation таблиц
                                 $arrTmp[$k] = $arrRelData[$kTmp];
                             } else {
                                 unset($arrTmp[$k]);
                             }
                         }
                     }
                     echo CJSON::encode(['status' => 'success', 'data' => $arrTmp]);
                 } else {
                     echo CJSON::encode(['status' => 'failed', 'data' => "not found"]);
                 }
             }
         } else {
             echo CJSON::encode(['status' => 'failed', 'data' => "wrong data"]);
         }
     } else {
         echo CJSON::encode(['status' => 'failed', 'data' => "access denied"]);
     }
     Yii::app()->end();
 }