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

Calling unknown method: yii\mongodb\Connection::cache() #189

Open
ElijahGM opened this issue Mar 3, 2017 · 2 comments
Open

Calling unknown method: yii\mongodb\Connection::cache() #189

ElijahGM opened this issue Mar 3, 2017 · 2 comments
Labels
type:enhancement Enhancement

Comments

@ElijahGM
Copy link

ElijahGM commented Mar 3, 2017

What steps will reproduce the problem?

How do you do a query cache?

What's expected?

What do you get instead?

Additional info

Q A
Yii version
Yii MongoDB version
MongoDB server version
PHP version
Operating system
@yii-bot
Copy link

yii-bot commented Mar 3, 2017

Thank you for your question.
In order for this issue tracker to be effective, it should only contain bug reports and feature requests.

We advise you to use our community driven resources:

If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.

This is an automated comment, triggered by adding the label question.

@yii-bot yii-bot closed this as completed Mar 3, 2017
@fl0v
Copy link

fl0v commented Aug 6, 2020

The current MongoDb Query implementation does not have cache capability :(
Caching has to be handled outside mongo interaction.

Would be nice though to be able to use caching with the model maping provided by \yii\mongodb\ActiveQuery.

I think \yii\mongodb\Query::fetchRowsInternal() could be enhanced with some magic similar to \yii\db\Command::queryInternal()

yii2-mongodb/src/Query.php

Lines 235 to 251 in e0140f8

protected function fetchRowsInternal($cursor, $all)
{
$result = [];
if ($all) {
foreach ($cursor as $row) {
$result[] = $row;
}
} else {
if ($row = current($cursor->toArray())) {
$result = $row;
} else {
$result = false;
}
}
return $result;
}

Maybe this issue should be reopened ?

@samdark samdark reopened this Aug 6, 2020
@samdark samdark added type:enhancement Enhancement and removed question labels Aug 6, 2020
fl0v pushed a commit to fl0v/yii2-mongodb that referenced this issue Aug 7, 2020
@fl0v fl0v mentioned this issue Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

5 participants