Merge branch 'add_header_to_resume_template' into document
This commit is contained in:
commit
5c0badaf92
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace backend\modules\card\controllers;
|
namespace backend\modules\card\controllers;
|
||||||
|
|
||||||
|
use common\classes\Debug;
|
||||||
use Yii;
|
use Yii;
|
||||||
use backend\modules\card\models\ResumeTemplate;
|
use backend\modules\card\models\ResumeTemplate;
|
||||||
use backend\modules\card\models\ResumeTemplateSearch;
|
use backend\modules\card\models\ResumeTemplateSearch;
|
||||||
|
@ -249,7 +249,7 @@ class UserCardController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function generateText(UserCard $userCard) {
|
private function generateText(UserCard $userCard) {
|
||||||
$resumeTemplate = ResumeTemplate::findOne($userCard->resumeTemplateId);
|
$resumeTemplate = ResumeTemplate::findOne($userCard->resume_template_id);
|
||||||
$resumeText = $resumeTemplate->template_body;
|
$resumeText = $resumeTemplate->template_body;
|
||||||
|
|
||||||
foreach (ResumeTemplate::$fieldSignatureDbName as $fieldSignature => $fieldDbName ) {
|
foreach (ResumeTemplate::$fieldSignatureDbName as $fieldSignature => $fieldDbName ) {
|
||||||
@ -278,24 +278,58 @@ class UserCardController extends Controller
|
|||||||
|
|
||||||
public function actionDownloadResumePdf($id)
|
public function actionDownloadResumePdf($id)
|
||||||
{
|
{
|
||||||
$model = UserCard::findOne($id);
|
$userCard = UserCard::findOne($id);
|
||||||
|
$resumeTemplate = ResumeTemplate::findOne($userCard->resume_template_id);
|
||||||
|
|
||||||
$pdf = new Pdf(); // or new Pdf();
|
if (empty($resumeTemplate->header_text)) {
|
||||||
$mpdf = $pdf->api; // fetches mpdf api
|
$headerText = 'Generated by ITGuild.info At: ' . date("d/m/Y");
|
||||||
$mpdf->SetHeader('Resume ' . $model->fio . '||Generated by ITGuild.info At: ' . date("d/m/Y")); // call methods or set any properties
|
} else {
|
||||||
|
$headerText = $resumeTemplate->header_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdf = new Pdf();
|
||||||
|
$mpdf = $pdf->api;
|
||||||
|
|
||||||
|
if (!pathinfo($resumeTemplate->header_image, PATHINFO_EXTENSION)) {
|
||||||
|
$mpdf->SetHeader($headerText);
|
||||||
|
} else {
|
||||||
|
$imagePath = Yii::getAlias('@frontend') . '/web' . $resumeTemplate->header_image;
|
||||||
|
$mpdf->setAutoTopMargin='stretch';
|
||||||
|
$mpdf->SetHTMLHeader(
|
||||||
|
"<div style='border-bottom: 1px solid #999;'>
|
||||||
|
<p><img src=$imagePath style='width: 100px; height: 40px; margin: 0; vertical-align: middle;'/>$headerText</p>
|
||||||
|
</div>"
|
||||||
|
);
|
||||||
|
}
|
||||||
$mpdf->SetFooter('{PAGENO}');
|
$mpdf->SetFooter('{PAGENO}');
|
||||||
$mpdf->WriteHtml($model->resume_text); // call mpdf write html
|
$mpdf->WriteHTML("<div>$userCard->resume_text</div>");
|
||||||
echo $mpdf->Output("Resume - {$model->fio}", 'D'); // call the mpdf api output as needed
|
$mpdf->Output("Resume - {$userCard->fio}", 'D'); // call the mpdf api output as needed
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionDownloadResumeDocx($id)
|
public function actionDownloadResumeDocx($id)
|
||||||
{
|
{
|
||||||
$model = UserCard::findOne($id);
|
$model = UserCard::findOne($id);
|
||||||
|
$resumeTemplate = ResumeTemplate::findOne($model->resume_template_id);
|
||||||
|
|
||||||
|
$imagePath = Yii::getAlias('@frontend') . '/web' . $resumeTemplate->header_image;
|
||||||
|
if (empty($resumeTemplate->header_text)) {
|
||||||
|
$headerText = 'Generated by ITGuild.info At: ' . date("d/m/Y");
|
||||||
|
} else {
|
||||||
|
$headerText = $resumeTemplate->header_text;
|
||||||
|
}
|
||||||
|
|
||||||
$pw = new \PhpOffice\PhpWord\PhpWord();
|
$pw = new \PhpOffice\PhpWord\PhpWord();
|
||||||
|
|
||||||
// (B) ADD HTML CONTENT
|
// (B) ADD HTML CONTENT
|
||||||
$section = $pw->addSection();
|
$section = $pw->addSection();
|
||||||
|
$header = $section->addHeader();
|
||||||
|
|
||||||
|
if (pathinfo($resumeTemplate->header_image, PATHINFO_EXTENSION)) {
|
||||||
|
$header->addImage($imagePath, ['width' => 70, 'height' => 30, 'align' => 'left']);
|
||||||
|
}
|
||||||
|
$header->addText($headerText, array('bold' => false), array('space' => array('before' => 0, 'after' => 280)));
|
||||||
|
|
||||||
$resumeText = str_replace(array('<br/>', '<br>', '</br>'), ' ', $model->resume_text);
|
$resumeText = str_replace(array('<br/>', '<br>', '</br>'), ' ', $model->resume_text);
|
||||||
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $resumeText, false, false);
|
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $resumeText, false, false);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class ResumeTemplateSearch extends ResumeTemplate
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['id', 'status'], 'integer'],
|
[['id', 'status'], 'integer'],
|
||||||
[['title', 'created_at', 'updated_at', 'template_body'], 'safe'],
|
[['title', 'created_at', 'updated_at', 'template_body', 'header_text', 'header_image'], 'safe'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +65,9 @@ class ResumeTemplateSearch extends ResumeTemplate
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$query->andFilterWhere(['like', 'title', $this->title])
|
$query->andFilterWhere(['like', 'title', $this->title])
|
||||||
->andFilterWhere(['like', 'template_body', $this->template_body]);
|
->andFilterWhere(['like', 'template_body', $this->template_body])
|
||||||
|
->andFilterWhere(['like', 'header_text', $this->header_text])
|
||||||
|
->andFilterWhere(['like', 'header_image', $this->header_image]);
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use asmoday74\ckeditor5\EditorClassic;
|
use asmoday74\ckeditor5\EditorClassic;
|
||||||
|
use backend\modules\card\models\ResumeTemplate;
|
||||||
use common\helpers\StatusHelper;
|
use common\helpers\StatusHelper;
|
||||||
|
use mihaildev\elfinder\InputFile;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\widgets\ActiveForm;
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
@ -31,6 +33,29 @@ use yii\widgets\ActiveForm;
|
|||||||
]
|
]
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'header_text')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<div class="imgUpload form-group">
|
||||||
|
<div class="media__upload_img">
|
||||||
|
<img src="<?= $model->header_image; ?>" width="100px"/>
|
||||||
|
</div>
|
||||||
|
<?php echo InputFile::widget([
|
||||||
|
'language' => 'ru',
|
||||||
|
'controller' => 'elfinder',
|
||||||
|
// вставляем название контроллера, по умолчанию равен elfinder
|
||||||
|
'filter' => 'image',
|
||||||
|
// фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-con..
|
||||||
|
'name' => 'ResumeTemplate[header_image]',
|
||||||
|
'id' => 'resumeTemplateHeader_img',
|
||||||
|
'template' => '<label>Картинка в верхнем контикуле</label><div class="input-group">{input}<span class="span-btn">{button}</span></div>',
|
||||||
|
'options' => ['class' => 'form-control itemImg', 'maxlength' => '255'],
|
||||||
|
'buttonOptions' => ['class' => 'btn btn-primary'],
|
||||||
|
'value' => $model->header_image,
|
||||||
|
'buttonName' => 'Выбрать изображение',
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
|
||||||
</div>
|
</div>
|
||||||
@ -49,74 +74,16 @@ use yii\widgets\ActiveForm;
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="info">
|
<?php
|
||||||
<td class="table-cell">ФИО</td>
|
foreach (ResumeTemplate::$fieldNamesAndSignature as $fieldNames => $signature) {
|
||||||
<td class="table-cell">${fio}</td>
|
echo "
|
||||||
</tr>
|
<tr class='info'>
|
||||||
<tr class="info">
|
<td class='table-cell'>$fieldNames</td>
|
||||||
<td class="table-cell">Паспорт</td>
|
<td class='table-cell'>$signature</td>
|
||||||
<td class="table-cell">${passport}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Электронная почта</td>
|
|
||||||
<td class="table-cell">${email}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Пол</td>
|
|
||||||
<td class="table-cell">${gender}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Резюме</td>
|
|
||||||
<td class="table-cell">${resume}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Зароботная плата</td>
|
|
||||||
<td class="table-cell">${salary}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Позиция</td>
|
|
||||||
<td class="table-cell">${position_id}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Город</td>
|
|
||||||
<td class="table-cell">${city}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Ссылка ВК</td>
|
|
||||||
<td class="table-cell">${link_vk}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Ссылка Телграм</td>
|
|
||||||
<td class="table-cell">${link_telegram}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Резюме текст</td>
|
|
||||||
<td class="table-cell">${vc_text}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Уровень</td>
|
|
||||||
<td class="table-cell">${level}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Резюме текст</td>
|
|
||||||
<td class="table-cell">${vc_text}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Резюме короткий текст</td>
|
|
||||||
<td class="table-cell">${vc_text_short}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Лет опыта</td>
|
|
||||||
<td class="table-cell">${years_of_exp}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Спецификация</td>
|
|
||||||
<td class="table-cell">${specification}</td>
|
|
||||||
</tr>
|
|
||||||
<tr class="info">
|
|
||||||
<td class="table-cell">Навыки</td>
|
|
||||||
<td class="table-cell">${skills}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -27,6 +27,10 @@ use yii\widgets\ActiveForm;
|
|||||||
|
|
||||||
<?php // echo $form->field($model, 'template_body') ?>
|
<?php // echo $form->field($model, 'template_body') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'header_text') ?>
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'header_image') ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
||||||
|
@ -33,6 +33,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
|
||||||
|
//'template_body:ntext',
|
||||||
|
//'header_text',
|
||||||
|
//'header_image',
|
||||||
|
|
||||||
['class' => 'yii\grid\ActionColumn'],
|
['class' => 'yii\grid\ActionColumn'],
|
||||||
],
|
],
|
||||||
]); ?>
|
]); ?>
|
||||||
|
@ -40,7 +40,16 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'filter' => StatusHelper::statusList(),
|
'filter' => StatusHelper::statusList(),
|
||||||
'value' => StatusHelper::statusLabel($model->status),
|
'value' => StatusHelper::statusLabel($model->status),
|
||||||
],
|
],
|
||||||
'template_body:ntext'
|
'header_text',
|
||||||
|
[
|
||||||
|
'attribute'=>'header_image',
|
||||||
|
'value'=>$model->header_image,
|
||||||
|
'format' => ['image',['width'=>'100','height'=>'100']],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'template_body',
|
||||||
|
'format' => 'raw'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ $this->params['breadcrumbs'][] = 'Резюме';
|
|||||||
?>
|
?>
|
||||||
<?= Html::hiddenInput('id', $model->id); ?>
|
<?= Html::hiddenInput('id', $model->id); ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'resumeTemplateId')->dropDownList(
|
<?= $form->field($model, 'resume_template_id')->dropDownList(
|
||||||
ResumeTemplate::find()->where(['status' => StatusHelper::STATUS_ACTIVE])->select(['title', 'id'])->indexBy('id')->column(),
|
ResumeTemplate::find()->where(['status' => StatusHelper::STATUS_ACTIVE])->select(['title', 'id'])->indexBy('id')->column(),
|
||||||
['prompt' => 'Выберите'])
|
['prompt' => 'Выберите'])
|
||||||
?>
|
?>
|
||||||
|
@ -16,6 +16,8 @@ use yii\helpers\ArrayHelper;
|
|||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
* @property int $status
|
* @property int $status
|
||||||
* @property string $template_body
|
* @property string $template_body
|
||||||
|
* @property string $header_text
|
||||||
|
* @property string $header_image
|
||||||
*/
|
*/
|
||||||
class ResumeTemplate extends \yii\db\ActiveRecord
|
class ResumeTemplate extends \yii\db\ActiveRecord
|
||||||
{
|
{
|
||||||
@ -87,7 +89,7 @@ class ResumeTemplate extends \yii\db\ActiveRecord
|
|||||||
[['created_at', 'updated_at'], 'safe'],
|
[['created_at', 'updated_at'], 'safe'],
|
||||||
[['status'], 'integer'],
|
[['status'], 'integer'],
|
||||||
[['template_body'], 'string'],
|
[['template_body'], 'string'],
|
||||||
[['title'], 'string', 'max' => 255],
|
[['title', 'header_text', 'header_image'], 'string', 'max' => 255],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +104,9 @@ class ResumeTemplate extends \yii\db\ActiveRecord
|
|||||||
'created_at' => 'Created At',
|
'created_at' => 'Created At',
|
||||||
'updated_at' => 'Updated At',
|
'updated_at' => 'Updated At',
|
||||||
'status' => 'Статус',
|
'status' => 'Статус',
|
||||||
'template_body' => 'Template Body'
|
'template_body' => 'Template Body',
|
||||||
|
'header_text' => 'Текст в верхнем контикуле',
|
||||||
|
'header_image' => 'Картинка в верхнем контикуле',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,11 @@ use yii\helpers\ArrayHelper;
|
|||||||
* @property string $test_task_getting_date
|
* @property string $test_task_getting_date
|
||||||
* @property string $test_task_complete_date
|
* @property string $test_task_complete_date
|
||||||
* @property string $resume_text
|
* @property string $resume_text
|
||||||
|
* @property int $resume_template_id
|
||||||
*
|
*
|
||||||
* @property FieldsValue[] $fieldsValues
|
* @property FieldsValue[] $fieldsValues
|
||||||
* @property ProjectUser[] $projectUsers
|
* @property ProjectUser[] $projectUsers
|
||||||
|
* @property ResumeTemplate $resumeTemplate
|
||||||
* @property Position $position
|
* @property Position $position
|
||||||
* @property Status $status0
|
* @property Status $status0
|
||||||
* @property Achievement[] $achievements
|
* @property Achievement[] $achievements
|
||||||
@ -59,7 +61,7 @@ class UserCard extends \yii\db\ActiveRecord
|
|||||||
const SCENARIO_GENERATE_RESUME_TEXT = 'generate_resume_text';
|
const SCENARIO_GENERATE_RESUME_TEXT = 'generate_resume_text';
|
||||||
const SCENARIO_UPDATE_RESUME_TEXT = 'update_resume_text';
|
const SCENARIO_UPDATE_RESUME_TEXT = 'update_resume_text';
|
||||||
|
|
||||||
public $resumeTemplateId;
|
// public $resumeTemplateId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return string[]
|
||||||
@ -117,9 +119,10 @@ class UserCard extends \yii\db\ActiveRecord
|
|||||||
[['salary'], 'string', 'max' => 100],
|
[['salary'], 'string', 'max' => 100],
|
||||||
[['position_id'], 'exist', 'skipOnError' => true, 'targetClass' => Position::class, 'targetAttribute' => ['position_id' => 'id']],
|
[['position_id'], 'exist', 'skipOnError' => true, 'targetClass' => Position::class, 'targetAttribute' => ['position_id' => 'id']],
|
||||||
[['status'], 'exist', 'skipOnError' => true, 'targetClass' => Status::class, 'targetAttribute' => ['status' => 'id']],
|
[['status'], 'exist', 'skipOnError' => true, 'targetClass' => Status::class, 'targetAttribute' => ['status' => 'id']],
|
||||||
['resumeTemplateId', 'required', 'on' => self::SCENARIO_GENERATE_RESUME_TEXT],
|
['resume_template_id', 'required', 'on' => self::SCENARIO_GENERATE_RESUME_TEXT],
|
||||||
['resumeTemplateId', 'integer', 'on' => self::SCENARIO_GENERATE_RESUME_TEXT],
|
['resume_template_id', 'integer', 'on' => self::SCENARIO_GENERATE_RESUME_TEXT],
|
||||||
['resume_text', 'required', 'on' => self::SCENARIO_UPDATE_RESUME_TEXT],
|
['resume_text', 'required', 'on' => self::SCENARIO_UPDATE_RESUME_TEXT],
|
||||||
|
// [['resume_template_id'], 'exist', 'skipOnError' => true, 'targetClass' => ResumeTemplate::className(), 'targetAttribute' => ['resume_template_id' => 'id'], 'on' => self::SCENARIO_GENERATE_RESUME_TEXT],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +157,7 @@ class UserCard extends \yii\db\ActiveRecord
|
|||||||
'specification' => 'Спецификация',
|
'specification' => 'Спецификация',
|
||||||
'test_task_getting_date' => 'Дата получения тестового',
|
'test_task_getting_date' => 'Дата получения тестового',
|
||||||
'test_task_complete_date' => 'Дата выполнения тестового',
|
'test_task_complete_date' => 'Дата выполнения тестового',
|
||||||
'resumeTemplateId' => 'Шаблон резюме',
|
'resume_template_id' => 'Шаблон резюме',
|
||||||
'resume_text' => 'Резюме сгенерированный текст'
|
'resume_text' => 'Резюме сгенерированный текст'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class m221110_133204_add_header__to_resume_template
|
||||||
|
*/
|
||||||
|
class m221110_133204_add_header_to_resume_template extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
$this->addColumn('resume_template', 'header_text', $this->string());
|
||||||
|
$this->addColumn('resume_template', 'header_image', $this->string());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
$this->dropColumn('resume_template', 'header_text');
|
||||||
|
$this->dropColumn('resume_template', 'header_image');
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use up()/down() to run migration code without a transaction.
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m221110_133204_add_header__to_resume_template cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles adding columns to table `{{%user_card}}`.
|
||||||
|
*/
|
||||||
|
class m221111_124753_add_resume_template_id_column_to_user_card_table extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
$this->addColumn('user_card','resume_template_id', $this->integer());
|
||||||
|
$this->addForeignKey('resume_template_user_card', 'user_card', 'resume_template_id', 'resume_template', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
$this->dropForeignKey('resume_template_user_card', 'user_card');
|
||||||
|
$this->dropColumn('user_card', 'resume_template_id');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user