Skip to content

Commit

Permalink
カスタムエントリーとブログ記事のインストール処理にて別のDB接続を利用できるように調整
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Nov 26, 2023
1 parent 9e55908 commit 91b702a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/bc-blog/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function install($options = []) : bool
{
$result = parent::install($options);
// ブログ記事の投稿日を更新
$this->updateDateNow('BcBlog.BlogPosts', ['posted']);
$this->updateDateNow('BcBlog.BlogPosts', ['posted'], [], $options);
return $result;
}

Expand Down
8 changes: 5 additions & 3 deletions plugins/bc-custom-content/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ class Plugin extends BcPlugin
*/
public function install($options = []): bool
{
// ここに必要なインストール処理を記述
$options = array_merge([
'connection' => 'default'
], $options);
$result = parent::install($options);
$table = TableRegistry::getTableLocator()->get('BcCustomContent.CustomEntries');
$table = TableRegistry::getTableLocator()->get('BcCustomContent.CustomEntries', ['connectionName' => $options['connection']]);
$table->setUp(1);
$this->updateDateNow('BcCustomContent.CustomEntries', ['published']);
$this->updateDateNow('BcCustomContent.CustomEntries', ['published'], [], $options);
return $result;
}

Expand Down

0 comments on commit 91b702a

Please sign in to comment.