cms
cms copied to clipboard
Can't query a single entry or term on URI (REST-API)
Bug description
When calling the API endpoint for a single entry or term, an exception is thrown and no result is returned.
Error message:
Object of class Statamic\Entries\Entry could not be converted to string
After an in-depth analysis, I found the following:
Resource controllers are used, which already give the complete collection as a parameter in the controller. However, it is assumed in the controller that an ID comes in and then a ::find()
query is made on the facade.
This leads to an object to string collision.
Translated with DeepL.com (free version)
How to reproduce
Activate the API for a collection and call the API endpoint for an entry with the ID.
Logs
No response
Environment
Environment
Application Name: Konkav & K16
Laravel Version: 11.24.1
PHP Version: 8.3.11
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: k16-konkav-cms.test
Maintenance Mode: OFF
Timezone: UTC
Locale: de
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 7
Sites: 5 (Konkav - DE, Konkav - EN, K16 - DE, K16 - EN, K16 - PL)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.26.0 PRO
Statamic Addons
aryehraber/statamic-uuid: 2.3.0
jonassiewertsen/statamic-documentation: 2.0.0
morethingsdigital/personio: dev-main
morethingsdigital/statamic-nextjs: 0.0.1
studio1902/statamic-peak-browser-appearance: 3.5.0
studio1902/statamic-peak-seo: 8.16.0
studio1902/statamic-peak-tools: 6.3.2
Installation
Existing Laravel app
Additional details
I create a PR that fixes the problem.