hotfix: auditSkipUpdateOnlyFields 프로퍼티→메서드로 변경(로그인 500 수정)
trait와 MemberModel이 같은 프로퍼티를 다른 기본값으로 선언해 PHP 비호환 fatal → 로그인(member update) 시 500. 메서드 override 방식으로 변경해 해결. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -41,9 +41,14 @@ trait Auditable
|
||||
/**
|
||||
* 이 필드들'만' 변경된 update는 활동 로그를 남기지 않는다.
|
||||
* (예: 로그인/세션 갱신 같은 시스템 내부 변경 — 노이즈 제거)
|
||||
* 모델에서 재정의해 사용.
|
||||
* 모델에서 이 메서드를 override 해 사용. (프로퍼티로 두면 trait/class 비호환 오류)
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
protected array $auditSkipUpdateOnlyFields = [];
|
||||
protected function auditSkipUpdateOnlyFields(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function auditMask(?array $row): ?array
|
||||
{
|
||||
@@ -106,9 +111,10 @@ trait Auditable
|
||||
$changes = is_array($eventData['data'] ?? null) ? $eventData['data'] : [];
|
||||
|
||||
// 지정 필드만 변경된 경우(로그인/세션 갱신 등) → 기록 생략
|
||||
if ($this->auditSkipUpdateOnlyFields !== [] && $changes !== []) {
|
||||
$skipOnly = $this->auditSkipUpdateOnlyFields();
|
||||
if ($skipOnly !== [] && $changes !== []) {
|
||||
$changedKeys = array_values(array_diff(array_keys($changes), [$this->primaryKey]));
|
||||
if ($changedKeys !== [] && array_diff($changedKeys, $this->auditSkipUpdateOnlyFields) === []) {
|
||||
if ($changedKeys !== [] && array_diff($changedKeys, $skipOnly) === []) {
|
||||
$this->auditBeforeRows = [];
|
||||
|
||||
return $eventData;
|
||||
|
||||
Reference in New Issue
Block a user