glesys / butler-graphql

An opinionated GraphQL package for Laravel.
MIT License
34 stars 5 forks source link

Support for eloquent strictness #52

Closed ttrig closed 1 year ago

ttrig commented 1 year ago

https://laravel.com/docs/9.x/eloquent#configuring-eloquent-strictness

Since we're resolving fields in snake, camel and kebab case a MissingAttributeException is thrown when eloquent is configured with $modelsShouldPreventAccessingMissingAttributes.

wecc commented 1 year ago

Can't we just catch (and ignore) MissingAttributeException in fieldFromObject?

ttrig commented 1 year ago

Can't we just catch (and ignore) MissingAttributeException in fieldFromObject?

See https://github.com/glesys/butler-graphql/pull/52/commits/313782a8a1837a207687654ba753e466286260be. Since models implement ArrayAccess I catch the exception in fieldFromArray as well.