Comments (13)
Ok, no worries. I will wait for it then 🙂. Good luck 🤞!
from collection.
Hi !
Interesting, let me check this out locally with version 6, master
and I'll get back to you.
from collection.
Thank you for VERY fast response @drupol 🍻
from collection.
You're welcome.
I cannot reproduce the issue with the master
branch, everything seems to be ok there.
Going to investigate the issue on version ^6
...
from collection.
This is the commit who fixed the issue a69acec
from collection.
Thanks! I suppose it will be soon pushed on the next library version?
from collection.
I'm still investigating which lines fixed the issue. I need to provide a fix and release a version 6.0.4 with the fix only.
from collection.
Ok, got the reason.
That commit is actually one of the most important commit. This is mostly the reason why there will be a major version bump.
The sad news is that I'm afraid this won't be fixable in v6 :( it would require to rewrite almost every operations.
The good news is that now I need to hurry and release version 7. I took a bit of delay to finish it. There's still #256 to finish and we're good to go.
from collection.
I see. It is ok. I managed to make a workaround on my side by casting the collection to an array (unfortunately), and getting the value by a key at that point. Keep up the good work, and can't wait for v7 🙂.
from collection.
And, of course, thank you for your help and fast reaction once again 👍️.
from collection.
I just added your tests in the codebase to make sure it doesn't happen again in v7 :)
Thanks for reporting it !
from collection.
Hi there!
Does the cache really work in this case?
$test = Collection::fromCallable(static function () {
var_dump('data call');
yield 100 => 'a';
})->cache();
$result1 = $test->all();
$result2 = $test->all();
var_dump($result1, $result2);
This code outputs following result:
string(9) "data call"
string(9) "data call"
array(1) {
[0]=>
string(1) "a"
}
array(1) {
[0]=>
string(1) "a"
}
It doesn't seem to work correctly, since it calls for data every time 🤔
from collection.
This is weird indeed, but this is an expected behavior due to the immutable nature of the Collection.
To make it work "as expected", add the squash
operation, use just use it without cache()
.
However, this issue gaves me an idea to add a new operation memorize
that would do that... I just did in 5 minutes, I might probably finalize it next week (see #316).
from collection.
Related Issues (20)
- `Partition` Operation - Awkward to use? HOT 18
- Add find/search/where/single/firstWhere method HOT 23
- Modify `all` operation to prevent data loss HOT 6
- PHPStan 1.0 upgrade HOT 1
- Typed collection support HOT 17
- API oddities HOT 6
- Reduction operations should return a single value HOT 9
- PHPStan reporting an error for missing optional parameters HOT 6
- [Question] Rename Collection interface to CollectionInterface HOT 1
- Dependency Dashboard HOT 54
- Collection interface doesn't extend Countable HOT 9
- Weird interplay between Collection and PDO result set HOT 13
- Plus operation RFC HOT 10
- Palm cannot infer types when using some operations HOT 4
- Unexpected behavior of pair operation over empty collection HOT 1
- [Feature request] Implement stable sorting HOT 12
- Memory size exhausted for large collections HOT 15
- Issue with distinct HOT 3
- Distinct is slow HOT 2
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 collection.