laravel-ide-helper icon indicating copy to clipboard operation
laravel-ide-helper copied to clipboard

feat(ModelsCommand): add configuration option to disable model query methods

Open pataar opened this issue 6 months ago • 0 comments

Summary

Introduced a new configuration option write_query_methods in config/ide-helper.php.
This controls whether the query(), newQuery(), and newModelQuery() methods are generated.

Since Laravel 11.15, these methods are properly typed in the framework itself, making IDE-helper’s versions largely redundant.
Overriding them may even lead to inconsistencies, so relying on the framework is likely safer.

However, disabling them by default felt too intrusive, so this setting is opt-in for now.

image ⬆ This is without the generated query() method, but using the generic query() from the framework.

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update
  • [ ] Misc. change (internal, infrastructure, maintenance, etc.)

Checklist

  • [x] Existing tests have been adapted and/or new tests have been added
  • [ ] Update the README.md
  • [x] Code style has been fixed via composer fix-style

pataar avatar Mar 31 '25 14:03 pataar