shalvah 4 years ago
parent
commit
d0a69809f2
2 changed files with 4 additions and 0 deletions
  1. 2 0
      CHANGELOG.md
  2. 2 0
      src/Extracting/Strategies/UrlParameters/GetFromLaravelAPI.php

+ 2 - 0
CHANGELOG.md

@@ -13,6 +13,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 ### Removals
 ### Removals
 
 
 ## 3.4.2 (Monday, 5 July 2021)
 ## 3.4.2 (Monday, 5 July 2021)
+### Modified
+- Only use model key type for URL param type if it's the same as the route key name (https://github.com/knuckleswtf/scribe/pull/265)
 ### Fixed
 ### Fixed
 - Merge user-defined endpoints correctly. (https://github.com/knuckleswtf/scribe/commit/b7f8539b1bd5cd4d97496fa93803a3d7894889f6)
 - Merge user-defined endpoints correctly. (https://github.com/knuckleswtf/scribe/commit/b7f8539b1bd5cd4d97496fa93803a3d7894889f6)
 
 

+ 2 - 0
src/Extracting/Strategies/UrlParameters/GetFromLaravelAPI.php

@@ -66,6 +66,8 @@ class GetFromLaravelAPI extends Strategy
                         continue;
                         continue;
                     }
                     }
 
 
+                    // If a user customized their routeKeyName,
+                    // we can't guarantee that it's the same type as the PK
                     $typeName = $argumentInstance->getKeyName() === $argumentInstance->getRouteKeyName()
                     $typeName = $argumentInstance->getKeyName() === $argumentInstance->getRouteKeyName()
                         ? $argumentInstance->getKeyType() : 'string';
                         ? $argumentInstance->getKeyType() : 'string';
                     $type = $this->normalizeTypeName($typeName);
                     $type = $this->normalizeTypeName($typeName);