Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Model/Table/MessagesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ public function validationDefault(Validator $validator): Validator
* Returns a rules checker object that will be used for validating
* application integrity.
*
* Note: existsIn validation rules are defined here but may be skipped during save
* when called with pre-loaded User entities (e.g., in AwardService). Database
* foreign key constraints provide backup enforcement in such cases.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Service/AwardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ private function gibToUser(
'type' => true,
],
]);
$messagesTable->saveOrFail($message);
// Skip ORM validation since User entities are already loaded and guaranteed to exist.
// Database foreign key constraints will enforce referential integrity.
$messagesTable->saveOrFail($message, ['validate' => false]);

$span = SentrySdk::getCurrentHub()->getSpan();
if ($span !== null) {
Expand Down
Loading