Compare commits

..
Author SHA1 Message Date
Barry vd. Heuvel 4434dfc550 Create release-drafter.yml 2024-10-28 15:14:10 +01:00
Barry vd. Heuvel 8fed0af7b1 Create update-changelog.yaml 2024-10-28 15:12:20 +01:00
6 changed files with 20 additions and 44 deletions
+1
View File
@@ -13,5 +13,6 @@
### Checklist ### Checklist
- [ ] Existing tests have been adapted and/or new tests have been added - [ ] Existing tests have been adapted and/or new tests have been added
- [ ] Add a CHANGELOG.md entry
- [ ] Update the README.md - [ ] Update the README.md
- [ ] Code style has been fixed via `composer fix-style` - [ ] Code style has been fixed via `composer fix-style`
-4
View File
@@ -1,4 +0,0 @@
template: |
## Whats Changed
$CHANGES
+13 -14
View File
@@ -1,21 +1,18 @@
# Changelog # Changelog
## 3.2.1 - 2024-10-28 All notable changes to this project will be documented in this file.
### What's Changed [Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v3.2.0...master)
* chore: Fix the description of unused option by @KentarouTakeda in https://github.com/barryvdh/laravel-ide-helper/pull/1600 --------------
* feat(pivot): add support for multiple pivot types when using the same accessor by @pataar in https://github.com/barryvdh/laravel-ide-helper/pull/1597
* Add support for `AsCollection::using` and `AsEnumCollection::of` casts by @uno-sw in https://github.com/barryvdh/laravel-ide-helper/pull/1577
* Smarter reset by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1603
* feat: use `numeric` type on fields with `decimal` casts by @ekisu in https://github.com/barryvdh/laravel-ide-helper/pull/1583
### New Contributors ### Changed
* @uno-sw made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1577 - Add support for multiple pivot types when using the same accessor.
* @ekisu made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1583 - Smarter reset, keep tags that IDE helper doesn't use
- Use `numeric` type on fields with `decimal` casts
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.2.0...v3.2.1
## 3.2.0 - 2024-10-18 2024-10-18, 3.2.0
--------------
### Fixed ### Fixed
- Fix type of hashed model property to `string` - Fix type of hashed model property to `string`
@@ -28,7 +25,8 @@
- Add support for AsCollection::using and AsEnumCollection::of casts [#1577 / uno-sw](https://github.com/barryvdh/laravel-ide-helper/pull/1577) - Add support for AsCollection::using and AsEnumCollection::of casts [#1577 / uno-sw](https://github.com/barryvdh/laravel-ide-helper/pull/1577)
## 3.1.0 - 2024-07-12 2024-07-12, 3.1.0
------------------
### Fixed ### Fixed
- Fix return value of query scopes from parent class [#1366 / sforward](https://github.com/barryvdh/laravel-ide-helper/pull/1366) - Fix return value of query scopes from parent class [#1366 / sforward](https://github.com/barryvdh/laravel-ide-helper/pull/1366)
@@ -41,7 +39,8 @@
- Add support for AsEnumCollection casts [#1557 / Braunson](https://github.com/barryvdh/laravel-ide-helper/pull/1557) - Add support for AsEnumCollection casts [#1557 / Braunson](https://github.com/barryvdh/laravel-ide-helper/pull/1557)
- Support for Attribute class in attributes [#1567 / stefanScrumble](https://github.com/barryvdh/laravel-ide-helper/pull/1567) - Support for Attribute class in attributes [#1567 / stefanScrumble](https://github.com/barryvdh/laravel-ide-helper/pull/1567)
## 3.0.0 - 2024-03-01 2024-03-01, 3.0.0
------------------
### Added ### Added
- Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520) - Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520)
+6 -12
View File
@@ -720,7 +720,7 @@ class ModelsCommand extends Command
$relationReturnType === 'many' || $relationReturnType === 'many' ||
( (
!$relationReturnType && !$relationReturnType &&
str_contains(get_class($relationObj), 'Many') strpos(get_class($relationObj), 'Many') !== false
) )
) { ) {
if ($relationObj instanceof BelongsToMany) { if ($relationObj instanceof BelongsToMany) {
@@ -729,22 +729,16 @@ class ModelsCommand extends Command
$pivot = $this->getClassNameInDestinationFile($model, $pivot); $pivot = $this->getClassNameInDestinationFile($model, $pivot);
if ($existingPivot = ($this->properties[$relationObj->getPivotAccessor()] ?? null)) { if ($existingPivot = ($this->properties[$relationObj->getPivotAccessor()] ?? null)) {
$existingClasses = explode('|', $existingPivot['type']); // If the pivot is already set, we need to append the type to it
$pivot .= '|' . $existingPivot['type'];
if (!in_array($pivot, $existingClasses)) {
array_unshift($existingClasses, $pivot);
}
} else { } else {
// No existing pivot property, so we need to add a null type // pivots are not always set
$existingClasses = [$pivot, 'null']; $pivot .= '|null';
} }
// create a union type of all pivot classes
$unionType = implode('|', $existingClasses);
$this->setProperty( $this->setProperty(
$relationObj->getPivotAccessor(), $relationObj->getPivotAccessor(),
$unionType, $pivot,
true, true,
false false
); );
@@ -33,12 +33,6 @@ class ModelWithPivot extends Model
->using(CustomPivot::class); ->using(CustomPivot::class);
} }
public function relationCustomPivotUsingSameAccessorAndClass()
{
return $this->belongsToMany(ModelwithPivot::class)
->using(CustomPivot::class);
}
public function relationWithDifferentCustomPivotUsingSameAccessor() public function relationWithDifferentCustomPivotUsingSameAccessor()
{ {
return $this->belongsToMany(ModelwithPivot::class) return $this->belongsToMany(ModelwithPivot::class)
@@ -14,8 +14,6 @@ use Illuminate\Database\Eloquent\Model;
* @property-read DifferentCustomPivot|CustomPivot|null $pivot * @property-read DifferentCustomPivot|CustomPivot|null $pivot
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationCustomPivotUsingSameAccessor * @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationCustomPivotUsingSameAccessor
* @property-read int|null $relation_custom_pivot_using_same_accessor_count * @property-read int|null $relation_custom_pivot_using_same_accessor_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationCustomPivotUsingSameAccessorAndClass
* @property-read int|null $relation_custom_pivot_using_same_accessor_and_class_count
* @property-read CustomPivot|null $customAccessor * @property-read CustomPivot|null $customAccessor
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithCustomPivot * @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithCustomPivot
* @property-read int|null $relation_with_custom_pivot_count * @property-read int|null $relation_with_custom_pivot_count
@@ -54,12 +52,6 @@ class ModelWithPivot extends Model
->using(CustomPivot::class); ->using(CustomPivot::class);
} }
public function relationCustomPivotUsingSameAccessorAndClass()
{
return $this->belongsToMany(ModelwithPivot::class)
->using(CustomPivot::class);
}
public function relationWithDifferentCustomPivotUsingSameAccessor() public function relationWithDifferentCustomPivotUsingSameAccessor()
{ {
return $this->belongsToMany(ModelwithPivot::class) return $this->belongsToMany(ModelwithPivot::class)