Bug description
Create an entries relationship field and set max items to 1, apply the UniqueEntryValue rule. Even if there's only one entry related, the value passed to the rule will be an array. This results into a Array to string conversion exception wihtin the EntryQueryBuilder, triggerd here.
A simple solution would to support array values within the rule, e.g.
$existing = $query
->when(
is_array($value),
fn ($query) => $query->whereIn($attribute, $value),
fn ($query) => $query->where($attribute, $value)
)
->first();
Might apply also to the other Unqiue-rules?
Any thoughs on this?
Thank you!
How to reproduce
See above
Logs
No response
Environment
EnvironmentApplication Name: wwwLaravel Version: 11.20.0PHP Version: 8.2.22Composer Version: 2.7.7Environment: localDebug Mode: ENABLEDURL: localhostMaintenance Mode: OFFTimezone: UTCLocale: deCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: CACHEDDriversBroadcasting: logCache: redisDatabase: mysqlLogs: stack / singleMail: logQueue: redisSession: fileLivewireLivewire: v3.5.4SentryEnabled: MISSING DSNEnvironment: localLaravel SDK Version: 4.7.1PHP SDK Version: 4.9.0Release: NOT SETSample Rate Errors: 100%Sample Rate Performance Monitoring: 0%Sample Rate Profiling: 0%Send Default PII: DISABLEDStatamicAddons: 0Sites: 6 (German, English, Spanish and 3 more)Stache Watcher: EnabledStatic Caching: DisabledVersion: 5.20.0 PRO
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
Bug description
Create an entries relationship field and set max items to 1, apply the UniqueEntryValue rule. Even if there's only one entry related, the value passed to the rule will be an array. This results into a
Array to string conversionexception wihtin the EntryQueryBuilder, triggerd here.A simple solution would to support array values within the rule, e.g.
Might apply also to the other Unqiue-rules?
Any thoughs on this?
Thank you!
How to reproduce
See above
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response