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

Handler for Model::preventAccessingMissingAttributes() #777

Closed
khalyomede opened this issue Sep 17, 2023 · 1 comment · Fixed by #824
Closed

Handler for Model::preventAccessingMissingAttributes() #777

khalyomede opened this issue Sep 17, 2023 · 1 comment · Fixed by #824
Assignees

Comments

@khalyomede
Copy link

Problem Statement

First of all, thank you for giving us a way to handle lazy loading/n+1 queries in production! It is so handy

Do you think we could have the same for Model::preventAccessingMissingAttributes()? This would be very useful too, in case test coverage does not cover all code used in production, and it happens a model attribute is being accessed when it does not exist or has not been loaded!

Solution Brainstorm

I guess it would be very similar to https://github.com/getsentry/sentry-laravel/blob/master/src/Sentry/Laravel/Integration.php#L225-L270 (I wonder if the check done to verify if the model exists can be stripped off for the missing attributes handler?)

@cleptric
Copy link
Member

This sounds reasonable. The way we currently report lazy loading violations to Sentry is a bit of a hack, though, as we do not use the issue platform, which powers N+1 queries performance issues but instead create a normal error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants