exception 'yii\base\ErrorException' with message 'Undefined index: data' in C:\OpenServer\OSPanel\domains\yii2\vendor\mpdf\mpdf\src\Writer\ImageWriter.php:96
Stack trace:
#0 C:\OpenServer\OSPanel\domains\yii2\vendor\mpdf\mpdf\src\Writer\ImageWriter.php(96): yii\base\ErrorHandler->handleError(8, 'Undefined index...', 'C:\\OpenServer\\O...', 96, Array)
#1 C:\OpenServer\OSPanel\domains\yii2\vendor\mpdf\mpdf\src\Writer\ResourceWriter.php(117): Mpdf\Writer\ImageWriter->writeImages()
#2 C:\OpenServer\OSPanel\domains\yii2\vendor\mpdf\mpdf\src\Mpdf.php(9832): Mpdf\Writer\ResourceWriter->writeResources()
#3 C:\OpenServer\OSPanel\domains\yii2\vendor\mpdf\mpdf\src\Mpdf.php(1997): Mpdf\Mpdf->_enddoc()
#4 C:\OpenServer\OSPanel\domains\yii2\vendor\mpdf\mpdf\src\Mpdf.php(9323): Mpdf\Mpdf->Close()
#5 C:\OpenServer\OSPanel\domains\yii2\vendor\kartik-v\yii2-mpdf\src\Pdf.php(409): Mpdf\Mpdf->Output('', 'S')
#6 C:\OpenServer\OSPanel\domains\yii2\vendor\kartik-v\yii2-mpdf\src\Pdf.php(261): kartik\mpdf\Pdf->output(' <!DOCTY...', '', 'I')
#7 C:\OpenServer\OSPanel\domains\yii2\backend\controllers\UsersController.php(194): kartik\mpdf\Pdf->render()
#8 [internal function]: backend\controllers\UsersController->actionSend('1')
#9 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#10 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('send', Array)
#12 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('users/send', Array)
#13 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#14 C:\OpenServer\OSPanel\domains\yii2\backend\web\index.php(17): yii\base\Application->run()
#15 {main}
2019-04-25 18:36:43 [127.0.0.1][1][7r090crlsftdrouhrrpcv1j3a1][info][application] $_GET = ['id' => '1'
]
2019-04-25 11:48:34 [127.0.0.1][1][7r090crlsftdrouhrrpcv1j3a1][error][yii\base\ViewNotFoundException] exception 'yii\base\ViewNotFoundException' with message 'The view file does not exist: C:\OpenServer\OSPanel\domains\yii2\backend\views\layouts\pdf.php' in C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\View.php:233
Stack trace:
#0 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Controller.php(399): yii\base\View->renderFile('C:\\OpenServer\\O...', Array, Object(backend\controllers\UsersController))
#1 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Controller.php(385): yii\base\Controller->renderContent('<!DOCTYPE html ...')
#2 C:\OpenServer\OSPanel\domains\yii2\backend\controllers\UsersController.php(174): yii\base\Controller->render('send', Array)
#3 [internal function]: backend\controllers\UsersController->actionSend('1')
#4 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#5 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#6 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Module.php(528): yii\base\Controller->runAction('send', Array)
#7 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\web\Application.php(103): yii\base\Module->runAction('users/send', Array)
#8 C:\OpenServer\OSPanel\domains\yii2\vendor\yiisoft\yii2\base\Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))
#9 C:\OpenServer\OSPanel\domains\yii2\backend\web\index.php(17): yii\base\Application->run()
#10 {main}
2019-04-25 11:48:34 [127.0.0.1][1][7r090crlsftdrouhrrpcv1j3a1][info][application] $_GET = [
'id' => '1'
]
public function rules()
{
return [
[['user_id', 'manager_contact_phone', 'manager_name', 'company_name', 'publish_new_per_run', 'date_subscription'], 'required'],
[['published_products_count', 'publish_day', 'publish_new_per_run', 'export_in_stock_only', 'can_future',
'export_allowed', 'has_subtotal', 'has_cian', 'avito_user_id', 'dub_h1_in_desc',
'has_timetable_param', 'has_vk', 'has_avito', 'has_yml', 'canContactPhone',
'available_url','disable_avito_export_yml','use_smart_publish','subscription',
'subscription_cost',/*'products_sorting',*/ 'subscription_period', 'ogrn', 'inn',
'bik', 'settlement_account', /*'for_mut', 'searchfordesc', 'use_onetime_publication'*/], 'integer'],
[['last_publishing_datetime','address','unloading_time','comment', 'date_subscription', 'date_subscription_end'], 'safe'],
[['avito_root_id', 'avito_login', 'avito_password', 'manager_contact_phone',
'company_name', 'manager_name', 'xml_feed', 'json_log_feed', 'all_ads_images', 'logo',
'text_begin', 'text_end', 'Region', 'City', 'subtotal_login', 'subtotal_password',
'client_id', 'client_secret', 'parent_ids','teg','url_avito','telegram_chat_id', 'category_list',
'time_start', 'time_finish', 'turbo_text', 'products_id', 'exceptions_time', 'comment'], 'string'],
[['user_id'], 'unique'],
[['user_id', 'show_vendor','show_compatibility', 'show_description','show_timetable','notice_user_telegram','can_vendor_code'], 'integer'],
];
}
public function beforeValidate() {
if ($this->date_subscription !== null) {
$this->date_subscription= strtotime($this->date_subscription);
}
return parent::beforeValidate();
}
[['date_subscription'], 'date', 'format' => 'php:Y-m-d']
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['date_subscription'],
ActiveRecord::EVENT_BEFORE_UPDATE => ['date_subscription'],
],
// если вместо метки времени UNIX используется datetime:
// 'value' => new Expression('NOW()'),
],
];
}
[
'label' => 'Дата начала подписки',
'value' => function ($model, $key, $value) {
return \kartik\date\DatePicker::widget([
'name' => 'date_subscription',
'model' => $model,
'value' => date('d-m-Y',$model->date_subscription),
'type' => DatePicker::TYPE_INPUT,
'pluginOptions' => [
'format' => 'yyyy-mm-dd',
'autoclose' => true,
],
]);
},
'contentOptions' => [
'onchange' => '
var Id = $(this).parent().attr("data-key");
var uDate = $(this).children("input").val();
console.log(Id + " - " + uDate);
$.ajax({
url: "'. Url::to('/admin/clients/ajax-request') .'",
type: "POST",
data:{id: Id, date: uDate},
success: function(data){
console.log(data)
}
})
'
],
'format' => 'raw',
],
public function actionAjaxRequest()
{
if(Yii::$app->request->isAjax){
$newDate = Yii::$app->request->post('date');
$uId = Yii::$app->request->post('id');
if(($model = UserSettings::findOne(['user_id' => $uId])) != null){
$model->date_subscription = strtotime($newDate);
if(!$model->update(false,['date_subscription'])){
return 'Данные не обновились.';
}
else{
return 'Данные успешно обновились.';
}
}
else{
return 'Пользователь не найден.';
}
}
return false;
}
То выдает ошибку: WriteHTML() requires $html be an integer, float, string, boolean or an object with the __toString() magic method.