Skip to content

Commit

Permalink
fix: Баг при копировании виджетов со страницы
Browse files Browse the repository at this point in the history
http://joxi.ru/a2XeN33SyYEMQA

Создаем новую страницу с копированием виджетов со старой.

При копировании виджетов на новую страницу копировались все виджеты со всех страниц.

(За 20 страниц у меня получилась база на 650 метров)))
  • Loading branch information
NelinD authored Jun 26, 2016
1 parent 6217623 commit 26e3796
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Manager/WidgetManagerDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ public function copyWidgets($formPageId, $toPageId)
intval($toPageId);
intval($formPageId);

$subSelect = DB::table('page_widgets as pw1')->selectRaw("'$toPageId' as page_id, pw1.widget_id, pw1.block, pw1.position, pw1.set_crumbs")->leftJoin('page_widgets as pw2', function (
$join
) {
return $join->on('pw1.widget_id', '=', 'pw2.widget_id');
})->where('pw1.page_id', $formPageId)->toSQL();
$subSelect = DB::table('page_widgets as pw1')
->selectRaw("'$toPageId' as page_id, pw1.widget_id, pw1.block, pw1.position, pw1.set_crumbs")
->where('pw1.page_id', $formPageId)
->toSQL();

DB::statement("INSERT into page_widgets (page_id, widget_id, block, position, set_crumbs) $subSelect", [
$formPageId,
Expand Down

0 comments on commit 26e3796

Please sign in to comment.