-
Notifications
You must be signed in to change notification settings - Fork 225
Unsupported enums #426
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
Labels
Comments
@eliasjtg Thanks for reporting this! I would greatly appreciate a PR for this. |
+1 also struggling with this bug |
mikebronner
added a commit
that referenced
this issue
Apr 26, 2022
add enum check when fetching values from where statements, fixes #426
alexhampu
added a commit
to alexhampu/laravel-model-caching
that referenced
this issue
May 2, 2022
I have tested the merged fix in one of the projects I'm currently working on, and I have found some issues. I haven't taken into consideration the other cases in which the where is an array. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
PHP 8.1 supports enums, Laravel 9 support enum cast but the package don't support it
Eloquent Query
Please provide the complete eloquent query that caused the bug, for example:
Stack Trace
[2022-03-17 15:25:27] local.ERROR: GeneaLabs\LaravelModelCaching\CacheKey::getValuesFromWhere(): Return value must be of type string, App\Enums\GameType returned {"exception":"[object] (TypeError(code: 0): GeneaLabs\LaravelModelCaching\CacheKey::getValuesFromWhere(): Return value must be of type string, App\Enums\GameType returned at /var/www/html/vendor/genealabs/laravel-model-caching/src/CacheKey.php:290)
[stacktrace]
#0 /var/www/html/vendor/genealabs/laravel-model-caching/src/CacheKey.php(267): GeneaLabs\LaravelModelCaching\CacheKey->getValuesFromWhere()
#1 /var/www/html/vendor/genealabs/laravel-model-caching/src/CacheKey.php(192): GeneaLabs\LaravelModelCaching\CacheKey->getValuesClause()
#2 /var/www/html/vendor/genealabs/laravel-model-caching/src/CacheKey.php(326): GeneaLabs\LaravelModelCaching\CacheKey->getOtherClauses()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(757): GeneaLabs\LaravelModelCaching\CacheKey->GeneaLabs\LaravelModelCaching\{closure}()
#4 /var/www/html/vendor/genealabs/laravel-model-caching/src/CacheKey.php(329): Illuminate\Support\Collection->reduce()
#5 /var/www/html/vendor/genealabs/laravel-model-caching/src/CacheKey.php(48): GeneaLabs\LaravelModelCaching\CacheKey->getWhereClauses()
#6 /var/www/html/vendor/genealabs/laravel-model-caching/src/Traits/Caching.php(182): GeneaLabs\LaravelModelCaching\CacheKey->make()
#7 /var/www/html/vendor/genealabs/laravel-model-caching/src/Traits/Buildable.php(86): GeneaLabs\LaravelModelCaching\CachedBuilder->makeCacheKey()
#8 /var/www/html/database/seeders/LottoSeeder.php(39): GeneaLabs\LaravelModelCaching\CachedBuilder->first()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Database\Seeders\LottoSeeder->run()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Seeder.php(175): Illuminate\Container\Container->call()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Seeder.php(184): Illuminate\Database\Seeder->Illuminate\Database\{closure}()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(75): Illuminate\Database\Seeder->__invoke()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php(155): Illuminate\Database\Console\Seeds\SeedCommand->Illuminate\Database\Console\Seeds\{closure}()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(76): Illuminate\Database\Eloquent\Model::unguarded()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Database\Console\Seeds\SeedCommand->handle()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#25 /var/www/html/vendor/symfony/console/Command/Command.php(291): Illuminate\Console\Command->execute()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#27 /var/www/html/vendor/symfony/console/Application.php(989): Illuminate\Console\Command->run()
#28 /var/www/html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#29 /var/www/html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#32 /var/www/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#33 {main}
Environment
The text was updated successfully, but these errors were encountered: