Skip to content

Commit

Permalink
ブログ記事をコピーする際、公開開始日、公開終了日をリセットするようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Sep 12, 2024
1 parent 385721a commit c32e26b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/bc-blog/src/Model/Table/BlogPostsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use BaserCore\Model\Entity\Content;
use BaserCore\Model\Table\UsersTable;
use BaserCore\Utility\BcUtil;
use BcBlog\Model\Entity\BlogPost;
use Cake\Core\Plugin;
use Cake\Database\Driver\Mysql;
use Cake\Database\Driver\Postgres;
Expand Down Expand Up @@ -642,13 +643,13 @@ public function createSearchIndex($post)
* コピーする
*
* @param int $id
* @param array $data
* @param BlogPost $data
* @return mixed page Or false
* @checked
* @noTodo
* @unitTest
*/
public function copy($id = null, $data = [])
public function copy($id = null, BlogPost $data = null)
{
if ($id) $data = $this->find()->where(['BlogPosts.id' => $id])->contain('BlogTags')->first();
$oldData = clone $data;
Expand All @@ -671,6 +672,8 @@ public function copy($id = null, $data = [])
$data->id = null;
$data->created = null;
$data->modified = null;
$data->publish_begin = null;
$data->publish_end = null;
// 一旦退避(afterSaveでリネームされてしまうのを避ける為)
$eyeCatch = $data->eye_catch;
$data->eye_catch = null;
Expand Down

0 comments on commit c32e26b

Please sign in to comment.