Skip to content

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

Closed
@JC5

Description

@JC5
Contributor

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!

Activity

added a commit that references this issue on Jul 28, 2024
420ce77
added a commit that references this issue on Feb 26, 2025
44b0772
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @JC5

      Issue actions

        Object of class Illuminate\Database\Query\Expression could not be converted to string · Issue #470 · mikebronner/laravel-model-caching