Comments (12)
@mikebronner: I just wanted to say that the problem in the current version 0.2.47 no longer occurs. Apparently, various changes have eliminated the problem.
Thanks for the active development!
from laravel-model-caching.
@bastian-schur Thanks for reporting. I will look into that ASAP. (Might have to wait until later today, but will be today for sure.)
from laravel-model-caching.
@bastian-schur I have not been able to replicate this. I tried the following query on different models, and they returned multiple results:
Model::all()->count();
Could you clear your cache and try again? Are you running a query on the same model before this one that returns only one result? (I'm wondering if perhaps the package is not creating the correct cache keys, or re-using on old cache key when running all()
.)
If you can provide some more information, that would help a lot! :)
from laravel-model-caching.
@mikebronner This problem only occurs if in your database table is only ONE(!) entry! In this case you get the same result like find or first - the requestet model itself. But all or get should return everytime a collection, also there is only one item.
I tryed this with the fallowing steps:
- Enable Caching, run dd(Model::all()) -> You receive the Model
- Disable Caching, run dd(Model::all()) -> You receive a collection with one Model
from laravel-model-caching.
Ah! Thank you for expanding on the issue. I will check that.
from laravel-model-caching.
Hi @bastian-schur, I was unable to recreate the issue. I implemented an integration test with only one record in the database, and it consistently returns a collection as intended. Can you provide a test repo using a fresh laravel install that reproduces this issue? Thanks!
from laravel-model-caching.
@mikebronner I will try it soon, but today i think i will get no time for this. In a short test i tryed it with extending my model directly from eloquent/model, so the modifications in my basemodel will have no influence. I also tryed it with laravel 5.6 but it takes no effect: same result.
from laravel-model-caching.
Hi @bastian-schur, could you try again using release 0.2.34? I have gone through and done some refactoring and quite a bit of cleanup. Please let me know how that works for you. :)
from laravel-model-caching.
@mikebronner thanks for your feedback. Unfortunately, there is no change with the problem.
I look forward to analyze the problem with a fresh laravel installation soon.
from laravel-model-caching.
@bastian-schur Thank you, please let me know your results, as I have been unable to replicate the issue so far.
from laravel-model-caching.
@bastian-schur closing this for now, please let me know if you continue to have this problem.
from laravel-model-caching.
Thanks for following up! :) Glad its working as intended. :)
from laravel-model-caching.
Related Issues (20)
- What is cacheCooldownSecounds definition? HOT 1
- Add support for Laravel 10 HOT 2
- Object of class Illuminate\\Database\\Query\\Expression could not be converted to string HOT 6
- Since 0.12.4 I get error "GeneaLabs\LaravelModelCaching\CacheKey::processEnum(): Argument #1 ($value) must be of type BackedEnum|UnitEnum|string, null given, called in ...\vendor\genealabs\laravel-model-caching\src\CacheKey.php on line 409" HOT 23
- Cannot access "parent" when current class scope has no parent HOT 1
- Laravel v10.3.0 breaks LaravelModelCaching HOT 2
- checkCooldownAndFlushAfterPersisting(): Argument #2 ($relationship) must be of type string, array given, called in /var/www/html/vendor/genealabs/laravel-model-caching/src/Traits/ModelCaching.php on line 83 HOT 8
- Is table join supported? HOT 7
- The attribute [column3] either does not exist or was not retrieved for model HOT 1
- Stale cached value returned where(...)->first() HOT 4
- Fix for GeneaLabs\LaravelModelCaching\CacheKey::processEnum(): Argument #1 ($value) must be of type BackedEnum|UnitEnum|string, null given
- processEnum(): Argument #1 ($value) must be of type BackedEnum|UnitEnum|Illuminate\Database\Query\Expression|string, null given HOT 2
- Conflict with Spatie Schemaless
- Laravel 11 upgrade blocked by laravel-pivot-events dependency HOT 1
- Missing import in CachedBuilder?
- Fix failing tests HOT 1
- Uuid fromBytes throwing a error HOT 1
- Observer for Pivot Model not firing HOT 3
- Bug: CacheKey::getValuesFromBindings(): Return value must be of type string, null returned | when where value is null HOT 1
- Object of class Illuminate\Database\Query\Expression could not be converted to string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-model-caching.