-
Notifications
You must be signed in to change notification settings - Fork 140
固定ページ・ブログ記事 afterAddイベント追加 #4312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -108,6 +108,10 @@ public function add(BlogPostsServiceInterface $service) | |||||
| $blogPost = $service->create($this->request->getData()); | ||||||
| $message = __d('baser_core', '記事「{0}」を追加しました。', $blogPost->title); | ||||||
| $this->BcMessage->setSuccess($message, true, false); | ||||||
| // EVENT BlogPosts.afterAdd | ||||||
|
||||||
| // EVENT BlogPosts.afterAdd | |
| // EVENT afterAdd (payload: ['data' => $blogPost]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同様の afterAdd 発火コードが Pages / BlogPosts の両方に追加されており、今後イベント名やペイロード構造を変更したくなった場合に差分が生まれやすいです。API 管理系の共通基底(または trait / ヘルパーメソッド)に「追加完了イベント発火」を集約するか、少なくともイベント名(
afterAdd)とペイロードキー(data)を定数化して、タイポや実装差異が入りにくい形に寄せるのを検討してください。