You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using custom route binding to convert a fancy string to an int backed enum but it breaks with the new enum handling in routes.
For example https://test.test/sales-orders/... will translate sales-orders to OrderType::SALES_ORDER.
But with the new changes from #51029 this doesn't work anymore.
It tries to convert $parameterValue to a string but it's already OrderType::SALES_ORDER.
We've fixed the issue by not returning the instantiated enum but just extracting the value out of it, aka returning an int.
Would be cool if $parameterValue could be checked to see if it's already an instantiated enum.
Steps To Reproduce
Create an int backed enum
<?phpnamespaceApp\Enums;
enum OrderType: int
{
caseSALES_ORDER = 1;
}
Laravel Version
11.4.0
PHP Version
8.3.4
Database Driver & Version
No response
Description
We're using custom route binding to convert a fancy string to an int backed enum but it breaks with the new enum handling in routes.
For example
https://test.test/sales-orders/...
will translatesales-orders
toOrderType::SALES_ORDER
.But with the new changes from #51029 this doesn't work anymore.
It tries to convert
$parameterValue
to astring
but it's alreadyOrderType::SALES_ORDER
.web.php
AppServiceProvider.php
We've fixed the issue by not returning the instantiated enum but just extracting the value out of it, aka returning an int.
Would be cool if
$parameterValue
could be checked to see if it's already an instantiated enum.Steps To Reproduce
Create an int backed enum
Add a route to the web.php
Add model binding to the AppServiceProvider.php
Navigate to
https://yourdomain.test/sales-orders
The text was updated successfully, but these errors were encountered: