Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't query a single entry or term on URI (REST-API) #10842

Open
christophstockinger opened this issue Sep 26, 2024 · 1 comment · May be fixed by #10844
Open

Can't query a single entry or term on URI (REST-API) #10842

christophstockinger opened this issue Sep 26, 2024 · 1 comment · May be fixed by #10844

Comments

@christophstockinger
Copy link

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.

christophstockinger added a commit to christophstockinger/statamic-cms that referenced this issue Sep 26, 2024
@christophstockinger christophstockinger changed the title Can't query a single entry or term on URI (REST-APO) Can't query a single entry or term on URI (REST-API) Sep 26, 2024
@duncanmcclean
Copy link
Member

Which endpoint are you seeing the error on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants