Bug Report: Strapi 5 - Relation Validation Locale Issue
### Node Version

20

### NPM/Yarn/PNPM Version

1.22.22

### Strapi Version

5.8.0

### Operating System

MacOS

### Database

PostgreSQL

### Javascript or Typescript

Javascript

### Reproduction URL

_No response_

### Bug Description

Environment
	•	Strapi Version: 5
	•	Database: PostgreSQL
	•	Operating System: macOS 23.4.0

Issue Description

When creating a booking via the REST API with related entities (units and users), we consistently receive a ValidationError stating:

	“Document with id [X], locale ‘null’ not found”

This occurs despite:
	1.	The related entities existing in the database.
	2.	Locales being explicitly set in the database.
	3.	Locale being included in the request payload.

Steps to Reproduce
	1.	Set up Strapi 5 with localization enabled.
	2.	Ensure related entities (units, accommodations) have locale = 'en' in the database.
	3.	Attempt to create a booking via the REST API with relations.

Example Request

curl -X POST 'https://your-strapi-url/api/bookings' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer [token]' \
-d '{
  "data": {
    "locale": "en",
    "startDate": "2025-01-30",
    "endDate": "2025-01-31",
    "firstName": "Test",
    "lastName": "Booking",
    "email": "test@example.com",
    "phoneNumber": "+1234567890",
    "guests": 2,
    "price": 1000,
    "BookingStatus": "Pending",
    "paymentStatus": "pending",
    "BookingDate": "2024-03-21",
    "bookingID": "test-123",
    "Terms": true,
    "CancellationPolicy": true,
    "units": { "connect": ["unit_document_id"] },
    "users_permissions_user": { "connect": ["user_document_id"] }
  }
}'

Troubleshooting Steps Taken

1. Relation Formats Tested
	•	Array of string IDs (["document_id"])
	•	Array of numeric IDs ([123])
	•	Array of objects with ID ([{ "id": 123 }])
	•	Array of objects with documentId ([{ "documentId": "xyz" }])

2. Database Verification

✅ Entities exist in the database.
✅ All units and accommodations have locale = 'en'.

3. Request Variations
	•	Explicitly added locale: "en" in the request body.
	•	Tried including/excluding locale in relations.
	•	Verified all required fields are present.

Error Message

{
  "data": null,
  "error": {
    "status": 400,
    "name": "ValidationError",
    "message": "Document with id \"[ID]\", locale \"null\" not found",
    "details": {}
  }
}

Expected Behavior

The booking should be created successfully, associating with existing related entities in the database that have the correct locale settings.

Actual Behavior

Strapi returns a ValidationError indicating that the related document cannot be found due to a “null” locale, despite the locale being set correctly in both the database and request.

Additional Context
	•	✅ Manual entries through the admin panel work correctly.
	•	❌ The issue occurs only when using the REST API.
	•	✅ All related entities have the correct locale settings in the database.
	•	❌ The error consistently states locale = null, regardless of locale handling in the request.

Questions for the Strapi Team
	1.	Is this a known issue with relation handling in Strapi 5?
	2.	Are there undocumented locale-handling requirements for related entities?
	3.	Is there a recommended workaround for this issue?
	4.	Could this be related to a migration from a previous Strapi version?

Impact

This issue prevents automated booking creation via API, forcing all bookings to be manually entered through the admin panel, significantly affecting workflow efficiency.

This refined version keeps all necessary details while improving readability and professionalism. Let me know if you’d like any adjustments! 🚀

### Steps to Reproduce

Issue happened only in Strapi 5 after migration

### Expected Behavior

save an entry with visible relations in the admin panel

### Logs

```shell

```

### Code Snippets

_No response_

### Media

_No response_

### Additional information

_No response_

### Confirmation Checklist

- [x] I have checked the existing [issues](https://github.com/strapi/strapi/issues) for duplicates.
- [x] I agree to follow this project's [Code of Conduct](https://github.com/strapi/strapi/blob/develop/CODE_OF_CONDUCT.md).