-
Notifications
You must be signed in to change notification settings - Fork 3
[203]: add model relations property annotations #208
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9b5e4b4
feat: add model relations property annotations
8b1a21e
chore: merge with master
4f8a534
refactor: add related models property annotations, remove duplicate code
48d2b8c
chore: add TODO
63a88a9
Merge branch 'master' into 203-relationships-annotation
DenTray 5e293d2
style: minor fixes
c928e1b
chore: merge with origin
c3c6115
Merge branch 'master' into 203-relationships-annotation
DenTray caf1c8c
refactor: fix model relation type, separate methods in ModelMockTrait
484b184
chore: merge with origin
21dd8aa
refactor: style fixes, remove redundant code
569c284
Merge branch 'master' into 203-relationships-annotation
DenTray 21ef6ff
Apply suggestion from @Copilot
DenTray 69628d2
Apply suggestion from @Copilot
DenTray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/fixtures/ModelGeneratorTest/related_model_with_property.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <?php | ||
|
|
||
| namespace RonasIT\Support\Tests\Support\Models; | ||
|
|
||
| use Illuminate\Database\Eloquent\Collection; | ||
| use Illuminate\Database\Eloquent\Model; | ||
| use RonasIT\Support\Traits\ModelTrait; | ||
|
|
||
| /** | ||
| * @property Collection<Category> $categories | ||
| */ | ||
| class WelcomeBonus extends Model | ||
| { | ||
| use ModelTrait; | ||
|
|
||
| public function getConnectionName(): string | ||
| { | ||
| return 'pgsql'; | ||
| } | ||
|
|
||
| protected $fillable = [ | ||
| 'title', | ||
| 'name', | ||
| ]; | ||
|
|
||
| public function some_relation() | ||
| { | ||
| } | ||
|
|
||
| public function categories() | ||
| { | ||
| return $this->belongsToMany(Category::class); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using unescaped output
{!! !!}for the property value could be a security concern if the value contains malicious content. However, since this is a code generator and values come from controlled sources (the generator itself), this is acceptable. Consider adding a comment explaining why unescaped output is necessary here (to preserve type syntax likeCollection<Model>).