From 18cd36ca0459fd86faa322b34c61dfb6c873b09d Mon Sep 17 00:00:00 2001 From: sakaguchi Date: Fri, 22 May 2026 13:41:21 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix=20#4337=20=E3=80=90=E3=82=B7=E3=82=B9?= =?UTF-8?q?=E3=83=86=E3=83=A0=E3=80=91=20=E3=82=B3=E3=83=B3=E3=83=86?= =?UTF-8?q?=E3=83=B3=E3=83=84=E3=82=B3=E3=83=94=E3=83=BC=E6=99=82=E3=81=AB?= =?UTF-8?q?=20layout=5Ftemplate=20=E3=81=8C=E5=BC=95=E3=81=8D=E7=B6=99?= =?UTF-8?q?=E3=81=8C=E3=82=8C=E3=81=AA=E3=81=84=E4=BB=B6=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/baser-core/src/Model/Table/ContentFoldersTable.php | 2 +- plugins/baser-core/src/Model/Table/PagesTable.php | 2 +- plugins/bc-content-link/src/Model/Table/ContentLinksTable.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/baser-core/src/Model/Table/ContentFoldersTable.php b/plugins/baser-core/src/Model/Table/ContentFoldersTable.php index baef379de9..7b90766c6f 100644 --- a/plugins/baser-core/src/Model/Table/ContentFoldersTable.php +++ b/plugins/baser-core/src/Model/Table/ContentFoldersTable.php @@ -176,7 +176,7 @@ public function copy(int $id, $newParentId, $newTitle, $newAuthorId, $newSiteId) 'site_id' => $newSiteId, 'description' => $entity->content->description, 'eyecatch' => $entity->content->eyecatch, - 'layout_template' => $entity->content->layout_tmplate ?? '' + 'layout_template' => $entity->content->layout_template ?? '' ]); if (!is_null($newSiteId) && $oldEntity->content->site_id !== $newSiteId) { $entity->content->parent_id = $this->Contents->copyContentFolderPath($entity->content->url, $newSiteId); diff --git a/plugins/baser-core/src/Model/Table/PagesTable.php b/plugins/baser-core/src/Model/Table/PagesTable.php index b7e1ac49a8..a885d32803 100644 --- a/plugins/baser-core/src/Model/Table/PagesTable.php +++ b/plugins/baser-core/src/Model/Table/PagesTable.php @@ -277,7 +277,7 @@ public function copy( 'title' => $newTitle ?? $oldPage->content->title . '_copy', 'author_id' => $newAuthorId, 'site_id' => $newSiteId, - 'layout_template' => $page->content->layout_tmplate ?? '' + 'layout_template' => $page->content->layout_template ?? '' ]); if (!is_null($newSiteId) && $oldPage->content->site_id !== $newSiteId) { diff --git a/plugins/bc-content-link/src/Model/Table/ContentLinksTable.php b/plugins/bc-content-link/src/Model/Table/ContentLinksTable.php index c8ebbacf21..41a139fe90 100644 --- a/plugins/bc-content-link/src/Model/Table/ContentLinksTable.php +++ b/plugins/bc-content-link/src/Model/Table/ContentLinksTable.php @@ -109,7 +109,7 @@ public function copy(int $id, $newParentId, $newTitle, $newAuthorId, $newSiteId) 'site_id' => $newSiteId, 'description' => $entity->content->description, 'eyecatch' => $entity->content->eyecatch, - 'layout_template' => $entity->content->layout_tmplate ?? '', + 'layout_template' => $entity->content->layout_template ?? '', 'url' => $entity->content->url ]); if (!is_null($newSiteId) && $oldEntity->content->site_id !== $newSiteId) { From 8b73b35b6a3074ee43e61b2d00206b5a951a2d01 Mon Sep 17 00:00:00 2001 From: sakaguchi Date: Fri, 29 May 2026 17:56:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix=20#4337=20=E3=80=90=E3=82=B7=E3=82=B9?= =?UTF-8?q?=E3=83=86=E3=83=A0=E3=80=91=20=E3=82=B3=E3=83=B3=E3=83=86?= =?UTF-8?q?=E3=83=B3=E3=83=84=E3=82=B3=E3=83=94=E3=83=BC=E6=99=82=E3=81=AB?= =?UTF-8?q?=20layout=5Ftemplate=20=E3=81=8C=E5=BC=95=E3=81=8D=E7=B6=99?= =?UTF-8?q?=E3=81=8C=E3=82=8C=E3=81=AA=E3=81=84=E4=BB=B6=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/TestCase/Model/Table/ContentFoldersTableTest.php | 1 + .../baser-core/tests/TestCase/Model/Table/PagesTableTest.php | 4 ++++ .../tests/TestCase/Model/Table/ContentLinksTableTest.php | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/plugins/baser-core/tests/TestCase/Model/Table/ContentFoldersTableTest.php b/plugins/baser-core/tests/TestCase/Model/Table/ContentFoldersTableTest.php index 5bc89da947..e912150b59 100644 --- a/plugins/baser-core/tests/TestCase/Model/Table/ContentFoldersTableTest.php +++ b/plugins/baser-core/tests/TestCase/Model/Table/ContentFoldersTableTest.php @@ -204,6 +204,7 @@ public function test_copy() //戻り値を確認 $this->assertEquals('new title', $rs->content->title); + $this->assertEquals('default', $rs->content->layout_template); //DBに存在するか確認すること $query = $contentFolders->find()->where(['folder_template' => 'baserCMSサンプル']); diff --git a/plugins/baser-core/tests/TestCase/Model/Table/PagesTableTest.php b/plugins/baser-core/tests/TestCase/Model/Table/PagesTableTest.php index c946c5d08f..ed360f492d 100644 --- a/plugins/baser-core/tests/TestCase/Model/Table/PagesTableTest.php +++ b/plugins/baser-core/tests/TestCase/Model/Table/PagesTableTest.php @@ -191,12 +191,16 @@ public function testCopy($id, $newParentId, $newTitle, $newAuthorId, $newSiteId) $this->loadFixtureScenario(InitAppScenario::class); $this->loadFixtureScenario(PagesScenario::class); $this->loadFixtureScenario(ContentsScenario::class); + $sourcePage = $this->Pages->get($id, contain: ['Contents']); + $contents = $this->getTableLocator()->get('BaserCore.Contents'); + $contents->updateAll(['layout_template' => 'page_layout'], ['id' => $sourcePage->content->id]); $this->loginAdmin($this->getRequest()); $result = $this->Pages->copy($id, $newParentId, $newTitle, $newAuthorId, $newSiteId); $page = $this->Pages->get($result->id, contain: ['Contents' => ['Sites']]); $this->assertStringContainsString("_2", $page->content->name); $this->assertEquals("hoge1", $page->content->title); $this->assertEquals(10, $page->content->author_id); + $this->assertEquals('page_layout', $page->content->layout_template); } public static function copyDataProvider() diff --git a/plugins/bc-content-link/tests/TestCase/Model/Table/ContentLinksTableTest.php b/plugins/bc-content-link/tests/TestCase/Model/Table/ContentLinksTableTest.php index 0c4d79a475..0f2534acf3 100644 --- a/plugins/bc-content-link/tests/TestCase/Model/Table/ContentLinksTableTest.php +++ b/plugins/bc-content-link/tests/TestCase/Model/Table/ContentLinksTableTest.php @@ -166,6 +166,8 @@ public function test_copy() { //データを生成 $this->loadFixtureScenario(ContentLinksServiceScenario::class); + $contents = $this->getTableLocator()->get('BaserCore.Contents'); + $contents->updateAll(['layout_template' => 'link_layout'], ['id' => 1]); //コピーメソッドをコール $rs = $this->ContentLinks->copy(1, 2, 'new title', 1, 2); //戻る値を確認 @@ -173,11 +175,13 @@ public function test_copy() $this->assertEquals(1, $rs->content->parent_id); $this->assertEquals(1, $rs->content->author_id); $this->assertEquals(2, $rs->content->site_id); + $this->assertEquals('link_layout', $rs->content->layout_template); $this->assertEquals(2, $rs->id); //DBに存在するか確認 $copiedContentLink = $this->ContentLinks->get(2, contain: ['Contents']); //コピー後の url の値の確認 $this->assertEquals('/new_title', $copiedContentLink->content->url); + $this->assertEquals('link_layout', $copiedContentLink->content->layout_template); } }