Jeramy Hing
472c1bad5d
Feature: Add Config Option to Enforce Nullable Relationships ( #1580 )
...
* feat: add config option for nullable relationships
Introduce enforce_nullable_relationships configuration to control nullable Eloquent relationships.
* refactor: update logic for nullable relationships
Update isRelationNullable method to respect new config option.
* test: add tests for nullable relationship config
- Verify behavior of enforce_nullable_relationships configuration option.
- Create snapshot to reflect enforce_nullable_relationships set to false.
* docs: improve documented context and usage
* docs: update CHANGELOG with enforce_nullable_relationships option
2024-10-30 22:35:58 +01:00
Menthol
cee441c87c
Fix #1300 relation_return_type must take precedence if it is defined ( #1394 )
2024-02-08 09:48:26 +01:00
Caleb White
6115100a0f
Add support for composite keys ( #1479 )
...
* Add support for composite keys
* chore: add composite foreign key test
2024-02-08 07:42:27 +01:00
Jefemy and Markus Podar
ee9188acf1
Implement new config to specify return type of custom relations ( #1300 )
...
* Implement new config to specify return type of custom relations
* Apply suggestions from code review
Co-authored-by: Markus Podar <[email protected] >
* add test for morphed
* fix test output
* add info about how to add custom relationships
* fix wording
Co-authored-by: Markus Podar <[email protected] >
2022-05-22 20:07:54 +02:00
efinder2 and Markus Podar
7305504c99
Created a positiblity to add custom relation type ( #987 )
...
* Created a positiblity to add custom relation type
* Changed access modifier
Co-authored-by: Markus Podar <[email protected] >
* fixed hints from code review
* Added Test for https://github.com/barryvdh/laravel-ide-helper/pull/987
* composer fix-style
* Clarify doc in config entry
* Update CHANGELOG.md
Co-authored-by: Markus Podar <[email protected] >
2020-09-08 07:18:43 +02:00
Markus Podar and Barry vd. Heuvel
764bc02b84
[CODESTYLE] Replace phpcs with php-cs-fixer ( #1030 )
...
* composer require --dev friendsofphp/php-cs-fixer:^2
* php-cs-fixer: ignore cache and custom local config file
* php-cs-fixer: initial config
* php-cs-fixer: replace commands in composer
* php-cs-fixer: add PSR12 "as good as it currently gets"
* php-cs-fixer: apply PSR12 to codebase
* tests: add workaround to keep unused imports for snapshot testing
* php-cs-fixer: apply no_unused_imports
* php-cs-fixer: apply array_syntax short
* php-cs-fixer: apply single_quote
* php-cs-fixer: switch ordered_imports sort_algorithm to alpha
Let's be opinionated here for consistency
* php-cs-fixer: split between non-tests and tests and share config
* php-cs-fixer: apply declare_strict_types for tests
* php-cs-fixer: apply fully_qualified_strict_types
* php-cs-fixer: apply space_after_semicolon
* php-cs-fixer: apply trailing_comma_in_multiline_array
* php-cs-fixer: apply trim_array_spaces
* php-cs-fixer: apply unary_operator_spaces
* php-cs-fixer: apply whitespace_after_comma_in_array
* php-cs-fixer: apply native_function_invocation
* php-cs-fixer: apply concat_space
* grumphp: reflect we're using phpcsfixer now
* composer remove --dev squizlabs/php_codesniffer
* gha: simplify fix-style approach
Not really necessary to remove packages and then manually prevent
unrelated commits creeping in
Co-authored-by: Barry vd. Heuvel <[email protected] >
2020-09-01 11:32:31 +02:00
Barry vd. Heuvel
9599cfbbc9
Simplify test by mocking filesystem always ( #1019 )
2020-08-25 17:43:39 +02:00
Markus Podar
ac6fbffac3
tests: ensure output mocking is disabled so we can actually catch the output ( #1018 )
...
Discovered via https://github.com/barryvdh/laravel-ide-helper/pull/1017#issuecomment-679318764
This only happens if you run an artisan command _before_ `runCommand`,
but since every of these tests performs migrations, using artisan,
the mocked output instance is left behind and also affected us.
The call added in `runCommand` explicitly unregisters
`\Illuminate\Console\OutputStyle` and thus also throwing away possibly
mocked versions.
2020-08-25 06:29:44 +02:00
Markus Podar
ba95d18ef5
[PHPCS] Extend to check/fix all source code and turn GHA into auto-commit fixer ( #1003 )
...
* phpcs: enable also for config, resources and tests
* composer fix-style
* vendor/bin/phpunit -d --update-snapshots
* gha: instead of checking the style, fix and auto-commit it 💪
2020-08-10 10:22:48 +02:00
07d45d2d7a
switch tests to snapshot assertions ( #958 )
...
* install spatie/phpunit-snapshot-assertions
* switch GenerateBasicPhpdocFinal test to snapshot assertion
* use v3 of spatie/phpunit-snapshot-assertions to be PHP7.2 compatible
* add txt snapshot driver
* fix EloquentCommandTest
* replace all heredocs by snapshots
* make test compatible with old/deprecated versions
* Update composer.json
* normalize composer.json
* fix merge conflict
* Allow older snapshot versions
* normalize composer.json
Co-authored-by: Barry vd. Heuvel <[email protected] >
Co-authored-by: barryvdh <[email protected] >
2020-06-24 11:11:35 +02:00
Gabriel Langer
6f20800eef
[Model] Simplify full namespaces for already included resources ( #954 )
...
* Fixed #565 by using the imported class name if present. Fixed a bug where cast type was not properly added when the return type was found via phpdoc.
* Fixed errors with phpdocumentor/type-resolver:1.0
2020-06-20 12:53:36 +02:00
leo108
18588eacf3
Make hasOne / hasOneThrough and morphOne nullable. ( #864 )
2020-03-31 14:40:50 +02:00
Kirill Uksusov
e743f44011
Fixed #892 ( #894 )
...
* Fixed #892
* #892 test added
2020-03-03 10:48:00 +01:00
Markus Podar
e020e265a4
Fixed bug in model command where loose string comparison would override properties for model relations ( #873 )
2020-01-12 18:23:52 +01:00
Markus Podar
6af1f32d96
tests: fix typo in migration 🤦♂️ and adapt tests ( #874 )
2020-01-12 18:23:27 +01:00
Matt A
972befd7aa
Prevent undefined property errors ( #877 )
...
If the property name matches the foreign key name
creating a BelongsTo relation triggers an undefined
property error. Disabling constraints prevents
accessing the property and thus prevents the error.
2020-01-12 17:51:04 +01:00
Markus Podar
c0bb9ee1fd
Add more tests ( #870 )
...
* tests: be more systematic when testing discrete column types
Still not covering all due to SQLite limitation
* tests: relations of models
* tests: model in another namespace gets correctly qualified
* tests: cover SoftDeletes trait
* tests: cover some variants of getter
2020-01-03 23:08:24 +01:00