Skip to content
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

Object of class Illuminate\Database\Query\Expression could not be converted to string #470

Open
JC5 opened this issue Jul 27, 2024 · 0 comments · May be fixed by #471
Open

Object of class Illuminate\Database\Query\Expression could not be converted to string #470

JC5 opened this issue Jul 27, 2024 · 0 comments · May be fixed by #471

Comments

@JC5
Copy link

JC5 commented Jul 27, 2024

Describe the bug

When I try to cache my Transaction model, I run into the title of this issue when the following query is being executed:

https://github.com/firefly-iii/firefly-iii/blob/1c8c038735eea258d3ad9db69af26d03206fa38f/app/Support/Models/AccountBalanceCalculator.php#L109

Stack Trace

See here, and:

#0 /home/runner/work/firefly-iii/firefly-iii/vendor/genealabs/laravel-model-caching/src/CacheKey.php(266): implode()
#1 /home/runner/work/firefly-iii/firefly-iii/vendor/genealabs/laravel-model-caching/src/CacheKey.php(52): GeneaLabs\LaravelModelCaching\CacheKey->getQueryColumns()
#2 /home/runner/work/firefly-iii/firefly-iii/vendor/genealabs/laravel-model-caching/src/Traits/Caching.php(182): GeneaLabs\LaravelModelCaching\CacheKey->make()
#3 /home/runner/work/firefly-iii/firefly-iii/vendor/genealabs/laravel-model-caching/src/Traits/Buildable.php(106): GeneaLabs\LaravelModelCaching\CachedBuilder->makeCacheKey()
#4 /home/runner/work/firefly-iii/firefly-iii/app/Support/Models/AccountBalanceCalculator.php(109): GeneaLabs\LaravelModelCaching\CachedBuilder->get()
#5 /home/runner/work/firefly-iii/firefly-iii/app/Support/Models/AccountBalanceCalculator.php(49): FireflyIII\Support\Models\AccountBalanceCalculator->recalculateLatest()
#6 /home/runner/work/firefly-iii/firefly-iii/app/Console/Commands/Upgrade/CorrectAccountBalance.php(55): FireflyIII\Support\Models\AccountBalanceCalculator::recalculateAll()
#7 /home/runner/work/firefly-iii/firefly-iii/app/Console/Commands/Upgrade/CorrectAccountBalance.php(47): FireflyIII\Console\Commands\Upgrade\CorrectAccountBalance->correctBalanceAmounts()
#8 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): FireflyIII\Console\Commands\Upgrade\CorrectAccountBalance->handle()
#9 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#10 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#11 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#12 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\Container\BoundMethod::call()
#13 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\Container\Container->call()
#14 /home/runner/work/firefly-iii/firefly-iii/vendor/symfony/console/Command/Command.php(279): Illuminate\Console\Command->execute()
#15 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\Component\Console\Command\Command->run()
#16 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php(67): Illuminate\Console\Command->run()
#17 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Concerns/CallsCommands.php(28): Illuminate\Console\Command->runCommand()
#18 /home/runner/work/firefly-iii/firefly-iii/app/Console/Commands/Upgrade/UpgradeDatabase.php(81): Illuminate\Console\Command->call()
#19 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): FireflyIII\Console\Commands\Upgrade\UpgradeDatabase->handle()
#20 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#21 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#22 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#23 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\Container\BoundMethod::call()
#24 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\Container\Container->call()
#25 /home/runner/work/firefly-iii/firefly-iii/vendor/symfony/console/Command/Command.php(279): Illuminate\Console\Command->execute()
#26 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\Component\Console\Command\Command->run()
#27 /home/runner/work/firefly-iii/firefly-iii/vendor/symfony/console/Application.php(1029): Illuminate\Console\Command->run()
#28 /home/runner/work/firefly-iii/firefly-iii/vendor/symfony/console/Application.php(316): Symfony\Component\Console\Application->doRunCommand()
#29 /home/runner/work/firefly-iii/firefly-iii/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun()
#30 /home/runner/work/firefly-iii/firefly-iii/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\Component\Console\Application->run()
#31 /home/runner/work/firefly-iii/firefly-iii/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#32 {main}

Environment
GitHub action.

Additional context
I also noticed this locally but this made it easy to see it's reproducible.

Thanks!

JC5 added a commit to JC5/laravel-model-caching that referenced this issue Jul 28, 2024
This should fix mikebronner#470 by making sure all columns are strings before imploding them.

Signed-off-by: James Cole <[email protected]>
@JC5 JC5 linked a pull request Jul 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant