@@ -203,7 +203,7 @@ private function prepareSelect(Select $select): Select
203
203
// check if the table has not been overridden for backward compatibility
204
204
if ($ this ->getMainTable () === $ this ->getTable ('importexport_importdata ' )) {
205
205
// user_id is NULL part is for backward compatibility
206
- $ select ->where ('user_id=? OR user_id is NULL ' , $ this ->getCurrentUserId () ?? self :: DEFAULT_USER_ID );
206
+ $ select ->where ('user_id=? OR user_id is NULL ' , $ this ->getUserId () );
207
207
}
208
208
209
209
return $ select ;
@@ -219,7 +219,7 @@ private function prepareInsert(array $data): array
219
219
{
220
220
// check if the table has not been overridden for backward compatibility
221
221
if ($ this ->getMainTable () === $ this ->getTable ('importexport_importdata ' )) {
222
- $ data ['user_id ' ] = $ this ->getCurrentUserId () ?? self :: DEFAULT_USER_ID ;
222
+ $ data ['user_id ' ] = $ this ->getUserId () ;
223
223
}
224
224
225
225
return $ data ;
@@ -236,7 +236,7 @@ private function prepareDelete(array $where): array
236
236
// check if the table has not been overridden for backward compatibility
237
237
if ($ this ->getMainTable () === $ this ->getTable ('importexport_importdata ' )) {
238
238
// user_id is NULL part is for backward compatibility
239
- $ where ['user_id=? OR user_id is NULL ' ] = $ this ->getCurrentUserId () ?? self :: DEFAULT_USER_ID ;
239
+ $ where ['user_id=? OR user_id is NULL ' ] = $ this ->getUserId () ;
240
240
}
241
241
242
242
return $ where ;
@@ -245,10 +245,10 @@ private function prepareDelete(array $where): array
245
245
/**
246
246
* Get current user ID
247
247
*
248
- * @return int|null
248
+ * @return int
249
249
*/
250
- private function getCurrentUserId (): ? int
250
+ private function getUserId (): int
251
251
{
252
- return $ this ->authSession ->isLoggedIn () ? $ this ->authSession ->getUser ()->getId () : null ;
252
+ return $ this ->authSession ->isLoggedIn () ? $ this ->authSession ->getUser ()->getId () : self :: DEFAULT_USER_ID ;
253
253
}
254
254
}
0 commit comments